Skip to content
Extraits de code Groupes Projets
Valider 7a89d8b1 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

only try to delete a post from a service if we're able to

parent 1256fda2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -150,7 +150,7 @@ class Postzord::Dispatcher ...@@ -150,7 +150,7 @@ class Postzord::Dispatcher
end end
end end
if @object.instance_of?(SignedRetraction) if @object.instance_of?(SignedRetraction)
services.each do |service| services.select { |service| service.respond_to? :delete_post }.each do |service|
Resque.enqueue(Jobs::DeletePostFromService, service.id, @object.target.facebook_id) Resque.enqueue(Jobs::DeletePostFromService, service.id, @object.target.facebook_id)
end end
end end
......
...@@ -317,10 +317,18 @@ describe Postzord::Dispatcher do ...@@ -317,10 +317,18 @@ describe Postzord::Dispatcher do
retraction = SignedRetraction.build(alice, FactoryGirl.create(:status_message)) retraction = SignedRetraction.build(alice, FactoryGirl.create(:status_message))
mailman = Postzord::Dispatcher.build(alice, retraction, :url => "http://joindiaspora.com/p/123", :services => [@service]) mailman = Postzord::Dispatcher.build(alice, retraction, :url => "http://joindiaspora.com/p/123", :services => [@service])
Resque.stub!(:enqueue).with(Jobs::DeletePostFromService, anything, anything)
Resque.should_receive(:enqueue).with(Jobs::DeletePostFromService, anything, anything) Resque.should_receive(:enqueue).with(Jobs::DeletePostFromService, anything, anything)
mailman.post mailman.post
end end
it "doesn't queue a job if we can't delete the post from the service" do
retraction = SignedRetraction.build(alice, FactoryGirl.create(:status_message))
service = Services::Twitter.new(access_token: "nope")
mailman = Postzord::Dispatcher.build(alice, retraction, :url => "http://joindiaspora.com/p/123", :services => [service])
Resque.should_not_receive(:enqueue).with(Jobs::DeletePostFromService, anything, anything)
mailman.post
end
end end
describe '#and_notify_local_users' do describe '#and_notify_local_users' do
......
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