send retractions for public targets publicly
This commit is contained in:
parent
793f45ef2c
commit
3df70bb205
2 changed files with 31 additions and 12 deletions
|
|
@ -39,6 +39,10 @@ class Retraction
|
|||
logger.info "event=retraction status=complete target=#{data[:target_type]}:#{data[:target_guid]}"
|
||||
end
|
||||
|
||||
def public?
|
||||
data[:target][:public]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :target
|
||||
|
|
|
|||
|
|
@ -1,19 +1,34 @@
|
|||
require 'spec_helper'
|
||||
require "spec_helper"
|
||||
|
||||
describe "Dispatching", :type => :request do
|
||||
describe "Dispatching", type: :request do
|
||||
context "a comment retraction on a public post" do
|
||||
it "should trigger a private dispatch" do
|
||||
luke, leia, raph = set_up_friends
|
||||
# Luke has a public post and comments on it
|
||||
post = FactoryGirl.create(:status_message, :public => true, :author => luke.person)
|
||||
it "triggers a public dispatch" do
|
||||
# Alice has a public post and comments on it
|
||||
post = FactoryGirl.create(:status_message, public: true, author: alice.person)
|
||||
|
||||
comment = alice.comment!(post, "awesomesauseum")
|
||||
|
||||
comment = luke.comment!(post, "awesomesauseum")
|
||||
|
||||
inlined_jobs do
|
||||
# Luke now retracts his comment
|
||||
expect(Postzord::Dispatcher::Public).not_to receive(:new)
|
||||
expect(Postzord::Dispatcher::Private).to receive(:new).and_return(double(:post => true))
|
||||
luke.retract(comment)
|
||||
# Alice now retracts her comment
|
||||
expect(Diaspora::Federation::Dispatcher::Public).to receive(:new).and_return(double(dispatch: true))
|
||||
expect(Diaspora::Federation::Dispatcher::Private).not_to receive(:new)
|
||||
alice.retract(comment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "a comment retraction on a private post" do
|
||||
it "triggers a private dispatch" do
|
||||
# Alice has a private post and comments on it
|
||||
post = alice.post(:status_message, text: "hello", to: alice.aspects.first)
|
||||
|
||||
comment = alice.comment!(post, "awesomesauseum")
|
||||
|
||||
inlined_jobs do
|
||||
# Alice now retracts her comment
|
||||
expect(Diaspora::Federation::Dispatcher::Public).not_to receive(:new)
|
||||
expect(Diaspora::Federation::Dispatcher::Private).to receive(:new).and_return(double(dispatch: true))
|
||||
alice.retract(comment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue