Commit 9fda255a authored by Benjamin Neff's avatar Benjamin Neff

use the parent author of the target as sender for relayable retractions

parent 5e0b1dd2
......@@ -29,7 +29,8 @@ class Retraction
def defer_dispatch(user, include_target_author=true)
subscribers = dispatch_subscribers(include_target_author)
Workers::DeferredRetraction.perform_async(, data,, service_opts(user))
sender = dispatch_sender(user)
Workers::DeferredRetraction.perform_async(, data,, service_opts(user))
def perform
......@@ -52,6 +53,11 @@ class Retraction
# @deprecated This is only needed for pre 0.6 pods
def dispatch_sender(user)
target.try(:sender_for_dispatch) || user
def service_opts(user)
return {} unless target.is_a?(StatusMessage)
......@@ -99,6 +99,18 @@ describe Retraction do
Retraction.for(comment, local_luke).defer_dispatch(local_luke)
it "uses the author of the target parent as sender for a comment-retraction if the parent is local" do
post =, text: "hello", public: true)
comment = local_leia.comment!(post, "destroy!")
federation_retraction = Diaspora::Federation::Entities.relayable_retraction(comment, local_leia)
expect(Workers::DeferredRetraction).to receive(:perform_async).with(, federation_retraction.to_h, [], {}
Retraction.for(comment, local_leia).defer_dispatch(local_leia)
context "relayable" do
let(:post) {, text: "hello", public: true) }
let(:comment) { FactoryGirl.create(:comment, post: post, author: remote_raphael) }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment