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]}"
|
logger.info "event=retraction status=complete target=#{data[:target_type]}:#{data[:target_guid]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def public?
|
||||||
|
data[:target][:public]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
attr_reader :target
|
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
|
context "a comment retraction on a public post" do
|
||||||
it "should trigger a private dispatch" do
|
it "triggers a public dispatch" do
|
||||||
luke, leia, raph = set_up_friends
|
# Alice has a public post and comments on it
|
||||||
# Luke has a public post and comments on it
|
post = FactoryGirl.create(:status_message, public: true, author: alice.person)
|
||||||
post = FactoryGirl.create(:status_message, :public => true, :author => luke.person)
|
|
||||||
|
comment = alice.comment!(post, "awesomesauseum")
|
||||||
|
|
||||||
comment = luke.comment!(post, "awesomesauseum")
|
|
||||||
|
|
||||||
inlined_jobs do
|
inlined_jobs do
|
||||||
# Luke now retracts his comment
|
# Alice now retracts her comment
|
||||||
expect(Postzord::Dispatcher::Public).not_to receive(:new)
|
expect(Diaspora::Federation::Dispatcher::Public).to receive(:new).and_return(double(dispatch: true))
|
||||||
expect(Postzord::Dispatcher::Private).to receive(:new).and_return(double(:post => true))
|
expect(Diaspora::Federation::Dispatcher::Private).not_to receive(:new)
|
||||||
luke.retract(comment)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue