relay retractions for relayables

This commit is contained in:
Benjamin Neff 2016-06-05 17:45:01 +02:00
parent 42995cacc0
commit 902d7faca4
2 changed files with 15 additions and 0 deletions

View file

@ -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

View file

@ -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