Remove backward-compatibility for Retractions
This commit is contained in:
parent
b6b0aac969
commit
381c03cfd7
2 changed files with 5 additions and 24 deletions
|
|
@ -21,8 +21,7 @@ class Retraction
|
|||
|
||||
def defer_dispatch(user, include_target_author=true)
|
||||
subscribers = dispatch_subscribers(include_target_author)
|
||||
sender = dispatch_sender(user)
|
||||
Workers::DeferredRetraction.perform_async(sender.id, data, subscribers.map(&:id), service_opts(user))
|
||||
Workers::DeferredRetraction.perform_async(user.id, data, subscribers.map(&:id), service_opts(user))
|
||||
end
|
||||
|
||||
def perform
|
||||
|
|
@ -32,8 +31,7 @@ class Retraction
|
|||
end
|
||||
|
||||
def public?
|
||||
# TODO: backward compatibility for pre 0.6 pods, they don't relay public retractions
|
||||
data[:target][:public] == true && (!data[:target][:parent] || data[:target][:parent][:local] == true)
|
||||
data[:target][:public]
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -45,11 +43,6 @@ class Retraction
|
|||
subscribers
|
||||
end
|
||||
|
||||
# @deprecated This is only needed for pre 0.6 pods
|
||||
def dispatch_sender(user)
|
||||
target.try(:sender_for_dispatch) || user
|
||||
end
|
||||
|
||||
def service_opts(user)
|
||||
return {} unless target.is_a?(StatusMessage)
|
||||
|
||||
|
|
|
|||
|
|
@ -101,18 +101,6 @@ describe Retraction do
|
|||
retraction.defer_dispatch(local_luke)
|
||||
end
|
||||
|
||||
it "uses the author of the target parent as sender for a comment-retraction if the parent is local" do
|
||||
post = local_luke.post(:status_message, text: "hello", public: true)
|
||||
comment = local_leia.comment!(post, "destroy!")
|
||||
federation_retraction = Diaspora::Federation::Entities.retraction(comment)
|
||||
|
||||
expect(Workers::DeferredRetraction).to receive(:perform_async).with(
|
||||
local_luke.id, federation_retraction.to_h, [remote_raphael.id], {}
|
||||
)
|
||||
|
||||
Retraction.for(comment).defer_dispatch(local_leia)
|
||||
end
|
||||
|
||||
context "relayable" do
|
||||
let(:post) { local_luke.post(:status_message, text: "hello", public: true) }
|
||||
let(:comment) { FactoryGirl.create(:comment, post: post, author: remote_raphael) }
|
||||
|
|
@ -158,10 +146,10 @@ describe Retraction do
|
|||
expect(Retraction.for(comment).public?).to be_truthy
|
||||
end
|
||||
|
||||
it "returns false for a public comment if parent post is not local" do
|
||||
remote_post = FactoryGirl.create(:status_message, author: remote_raphael)
|
||||
it "returns true for a public comment if parent post is not local" do
|
||||
remote_post = FactoryGirl.create(:status_message, author: remote_raphael, public: true)
|
||||
comment = alice.comment!(remote_post, "destroy!")
|
||||
expect(Retraction.for(comment).public?).to be_falsey
|
||||
expect(Retraction.for(comment).public?).to be_truthy
|
||||
end
|
||||
|
||||
it "returns false for a private target" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue