Skip to content
Extraits de code Groupes Projets
Valider 3df70bb2 rédigé par Benjamin Neff's avatar Benjamin Neff
Parcourir les fichiers

send retractions for public targets publicly

parent 793f45ef
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
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")
inlined_jobs do
# 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")
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).not_to receive(:new)
expect(Diaspora::Federation::Dispatcher::Private).to receive(:new).and_return(double(dispatch: true))
alice.retract(comment)
end
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter