Take error out of posting status messages with photos
This commit is contained in:
parent
3e2c9b4b94
commit
de475ec4eb
4 changed files with 17 additions and 7 deletions
|
|
@ -57,8 +57,11 @@ class PhotosController < ApplicationController
|
|||
|
||||
|
||||
aspects = current_user.aspects_from_ids(params[:photo][:aspect_ids])
|
||||
current_user.add_to_streams(@photo, aspects)
|
||||
current_user.dispatch_post(@photo, :to => params[:photo][:aspect_ids]) unless @photo.pending
|
||||
|
||||
unless @photo.pending
|
||||
current_user.add_to_streams(@photo, aspects)
|
||||
current_user.dispatch_post(@photo, :to => params[:photo][:aspect_ids])
|
||||
end
|
||||
|
||||
if params[:photo][:set_profile_photo]
|
||||
profile_params = {:image_url => @photo.url(:thumb_large),
|
||||
|
|
|
|||
|
|
@ -27,11 +27,14 @@ class StatusMessagesController < ApplicationController
|
|||
if !photos.empty?
|
||||
@status_message.photos += photos
|
||||
for photo in photos
|
||||
was_pending = photo.pending
|
||||
photo.public = public_flag
|
||||
photo.pending = false
|
||||
photo.save
|
||||
current_user.add_to_streams(photo, aspects)
|
||||
current_user.dispatch_post(photo)
|
||||
if was_pending
|
||||
current_user.add_to_streams(photo, aspects)
|
||||
current_user.dispatch_post(photo)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@ class Photo < Post
|
|||
end
|
||||
|
||||
def status_message_guid
|
||||
self.status_message.guid
|
||||
if self.status_message
|
||||
self.status_message.guid
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def status_message_guid= new_sm_guid
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ describe StatusMessagesController do
|
|||
fixture_filename = 'button.png'
|
||||
fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', fixture_filename)
|
||||
|
||||
@photo1 = @user1.build_post(:photo, :user_file=> File.open(fixture_name), :to => @aspect1.id)
|
||||
@photo2 = @user1.build_post(:photo, :user_file=> File.open(fixture_name), :to => @aspect1.id)
|
||||
@photo1 = @user1.build_post(:photo, :pending => true, :user_file=> File.open(fixture_name), :to => @aspect1.id)
|
||||
@photo2 = @user1.build_post(:photo, :pending => true, :user_file=> File.open(fixture_name), :to => @aspect1.id)
|
||||
|
||||
@photo1.save!
|
||||
@photo2.save!
|
||||
|
|
|
|||
Loading…
Reference in a new issue