made the postzord take the services in individually
This commit is contained in:
parent
126925f28f
commit
e61cc2fd34
5 changed files with 23 additions and 10 deletions
|
|
@ -25,7 +25,9 @@ class StatusMessagesController < ApplicationController
|
||||||
Rails.logger.info("event=create type=status_message chars=#{params[:status_message][:message].length}")
|
Rails.logger.info("event=create type=status_message chars=#{params[:status_message][:message].length}")
|
||||||
|
|
||||||
current_user.add_to_streams(@status_message, aspects)
|
current_user.add_to_streams(@status_message, aspects)
|
||||||
current_user.dispatch_post(@status_message, :url => post_url(@status_message), :services => current_user.services)
|
receiving_services = params[:services].map{|s| current_user.services.where(
|
||||||
|
:type => "Services::"+s.titleize).first} if params[:services]
|
||||||
|
current_user.dispatch_post(@status_message, :url => post_url(@status_message), :services => receiving_services)
|
||||||
if !photos.empty?
|
if !photos.empty?
|
||||||
for photo in photos
|
for photo in photos
|
||||||
was_pending = photo.pending
|
was_pending = photo.pending
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
= link_to (image_tag "social_media_logos/feed-16x16.png", :title => "RSS"), current_user.public_url
|
= link_to (image_tag "social_media_logos/feed-16x16.png", :title => "RSS"), current_user.public_url
|
||||||
- if current_user.services
|
- if current_user.services
|
||||||
- for service in current_user.services
|
- for service in current_user.services
|
||||||
= image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider
|
= image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider, :class => "service", :id =>"#{service.provider}"
|
||||||
|
|
||||||
= link_to '(?)', "#question_mark_pane", :class => 'question_mark', :style=>"display:none;", :rel => 'facebox'
|
= link_to '(?)', "#question_mark_pane", :class => 'question_mark', :style=>"display:none;", :rel => 'facebox'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,10 @@ class Postzord::Dispatch
|
||||||
def deliver_to_services(url, services)
|
def deliver_to_services(url, services)
|
||||||
if @object.respond_to?(:public) && @object.public
|
if @object.respond_to?(:public) && @object.public
|
||||||
deliver_to_hub
|
deliver_to_hub
|
||||||
if @object.respond_to?(:message)
|
end
|
||||||
services.each do |service|
|
if @object.respond_to?(:message)
|
||||||
Resque.enqueue(Job::PostToService, service.id, @object.id, url)
|
services.each do |service|
|
||||||
end
|
Resque.enqueue(Job::PostToService, service.id, @object.id, url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,12 @@ describe StatusMessagesController do
|
||||||
response.status.should == 201
|
response.status.should == 201
|
||||||
end
|
end
|
||||||
|
|
||||||
it "dispatches the post to the user's services" do
|
it "dispatches the post to the specified services" do
|
||||||
@user1.services << Services::Facebook.new
|
s1 = Services::Facebook.new
|
||||||
@user1.should_receive(:dispatch_post).with(anything(),hash_including(:services => @user1.services))
|
@user1.services << s1
|
||||||
|
@user1.services << Services::Twitter.new
|
||||||
|
status_message_hash[:services] = ['facebook']
|
||||||
|
@user1.should_receive(:dispatch_post).with(anything(), hash_including(:services => [s1]))
|
||||||
post :create, status_message_hash
|
post :create, status_message_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,15 @@ describe Postzord::Dispatch do
|
||||||
|
|
||||||
Resque.stub!(:enqueue).with(Job::PublishToHub, anything)
|
Resque.stub!(:enqueue).with(Job::PublishToHub, anything)
|
||||||
Resque.should_receive(:enqueue).with(Job::PostToService, @s1.id, anything, anything)
|
Resque.should_receive(:enqueue).with(Job::PostToService, @s1.id, anything, anything)
|
||||||
mailman.post(:url => "http://joindiaspora.com/p/123", :services => [@s1, @s2])
|
mailman.post(:url => "http://joindiaspora.com/p/123", :services => [@s1])
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not push to services if none are specified' do
|
||||||
|
mailman = Postzord::Dispatch.new(@user, Factory(:status_message))
|
||||||
|
|
||||||
|
Resque.stub!(:enqueue).with(Job::PublishToHub, anything)
|
||||||
|
Resque.should_not_receive(:enqueue).with(Job::PostToService, anything, anything, anything)
|
||||||
|
mailman.post(:url => "http://joindiaspora.com/p/123")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue