Fix receiving a relayable retraction through the public route
This commit is contained in:
parent
5ca1c1d295
commit
499ff6e0f4
3 changed files with 16 additions and 5 deletions
|
|
@ -60,4 +60,8 @@ class RelayableRetraction < SignedRetraction
|
||||||
def parent_author_signature_valid?
|
def parent_author_signature_valid?
|
||||||
verify_signature(self.parent_author_signature, self.parent.author)
|
verify_signature(self.parent_author_signature, self.parent.author)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parent_diaspora_handle
|
||||||
|
target.author.diaspora_handle
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,15 @@ class Postzord::Receiver::Public < Postzord::Receiver
|
||||||
return false unless save_object
|
return false unless save_object
|
||||||
|
|
||||||
FEDERATION_LOGGER.info("received a #{@object.inspect}")
|
FEDERATION_LOGGER.info("received a #{@object.inspect}")
|
||||||
if @object.respond_to?(:relayable?)
|
if @object.is_a?(SignedRetraction) # feels like a hack
|
||||||
receive_relayable
|
|
||||||
elsif @object.is_a?(AccountDeletion)
|
|
||||||
#nothing
|
|
||||||
elsif @object.is_a?(SignedRetraction) # feels like a hack
|
|
||||||
self.recipient_user_ids.each do |user_id|
|
self.recipient_user_ids.each do |user_id|
|
||||||
user = User.where(id: user_id).first
|
user = User.where(id: user_id).first
|
||||||
@object.perform user if user
|
@object.perform user if user
|
||||||
end
|
end
|
||||||
|
elsif @object.respond_to?(:relayable?)
|
||||||
|
receive_relayable
|
||||||
|
elsif @object.is_a?(AccountDeletion)
|
||||||
|
#nothing
|
||||||
else
|
else
|
||||||
Workers::ReceiveLocalBatch.perform_async(@object.class.to_s, @object.id, self.recipient_user_ids)
|
Workers::ReceiveLocalBatch.perform_async(@object.class.to_s, @object.id, self.recipient_user_ids)
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,13 @@ describe RelayableRetraction do
|
||||||
expect(Postzord::Dispatcher).not_to receive(:build)
|
expect(Postzord::Dispatcher).not_to receive(:build)
|
||||||
@retraction.receive(@recipient, @remote_raphael)
|
@retraction.receive(@recipient, @remote_raphael)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'performs through postzord' do
|
||||||
|
xml = Salmon::Slap.create_by_user_and_activity(@local_luke, @retraction.to_diaspora_xml).xml_for(nil)
|
||||||
|
expect {
|
||||||
|
Postzord::Receiver::Public.new(xml).perform!
|
||||||
|
}.to change(Comment, :count).by(-1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue