Allow Retraction to deal with Relayables
This commit is contained in:
parent
fdb3ae5cb8
commit
4e41b8dc86
1 changed files with 9 additions and 1 deletions
|
|
@ -46,6 +46,14 @@ class Retraction
|
||||||
logger.info "event=retraction status=complete type=#{type} guid=#{post_guid}"
|
logger.info "event=retraction status=complete type=#{type} guid=#{post_guid}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def correct_authorship?
|
||||||
|
if target.respond_to?(:relayable?) && target.relayable?
|
||||||
|
[target.author, target.parent.author].include?(person)
|
||||||
|
else
|
||||||
|
target.author == person
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def receive(user, person)
|
def receive(user, person)
|
||||||
if self.type == 'Person'
|
if self.type == 'Person'
|
||||||
unless self.person.guid.to_s == self.post_guid.to_s
|
unless self.person.guid.to_s == self.post_guid.to_s
|
||||||
|
|
@ -55,7 +63,7 @@ class Retraction
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
user.disconnected_by(self.target)
|
user.disconnected_by(self.target)
|
||||||
elsif self.target.nil? || self.target.author != self.person
|
elsif target.nil? || !correct_authorship?
|
||||||
logger.warn "event=retraction status=abort reason='no post found authored by retractor' " \
|
logger.warn "event=retraction status=abort reason='no post found authored by retractor' " \
|
||||||
"sender=#{person.diaspora_handle} post_guid=#{post_guid}"
|
"sender=#{person.diaspora_handle} post_guid=#{post_guid}"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue