only try to delete a post from a service if we're able to
This commit is contained in:
parent
1256fda24b
commit
7a89d8b161
2 changed files with 10 additions and 2 deletions
|
|
@ -150,7 +150,7 @@ class Postzord::Dispatcher
|
|||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -317,10 +317,18 @@ describe Postzord::Dispatcher do
|
|||
retraction = SignedRetraction.build(alice, FactoryGirl.create(:status_message))
|
||||
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)
|
||||
mailman.post
|
||||
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
|
||||
|
||||
describe '#and_notify_local_users' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue