diff --git a/lib/diaspora/federation/receive.rb b/lib/diaspora/federation/receive.rb index aa5c4ee95..4ef4e459d 100644 --- a/lib/diaspora/federation/receive.rb +++ b/lib/diaspora/federation/receive.rb @@ -139,6 +139,15 @@ module Diaspora case object when Person User.find(recipient_id).disconnected_by(object) + when Diaspora::Relayable + if object.parent.author.local? + parent_author = object.parent.author.owner + retraction = Retraction.for(object, parent_author) + retraction.defer_dispatch(parent_author) + retraction.perform + else + object.destroy! + end else object.destroy! end diff --git a/spec/integration/federation/shared_receive_stream_items.rb b/spec/integration/federation/shared_receive_stream_items.rb index 7e0df492e..391c194cf 100644 --- a/spec/integration/federation/shared_receive_stream_items.rb +++ b/spec/integration/federation/shared_receive_stream_items.rb @@ -150,6 +150,12 @@ shared_examples_for "messages which can't be send without sharing" do context "with #{retraction_entity_name}" do let(:entity_name) { "#{retraction_entity_name}_entity".to_sym } + before do + allow(DiasporaFederation.callbacks).to receive(:trigger).with( + :fetch_private_key, alice.diaspora_handle + ) { alice.encryption_key } + end + context "with comment" do it_behaves_like "it retracts relayable object" do # case for to-upstream federation