Undo part of the refactor so that StatusMessage validations work.

This commit is contained in:
Raphael Sofaer 2011-07-21 17:56:53 -07:00
parent caf26a5c64
commit e2bdd54dd8

View file

@ -40,14 +40,14 @@ class StatusMessagesController < ApplicationController
@status_message = current_user.build_post(:status_message, params[:status_message])
photos = Photo.where(:id => [*params[:photos]], :diaspora_handle => current_user.person.diaspora_handle)
unless photos.empty?
@status_message.photos << photos
end
if @status_message.save
Rails.logger.info("event=create type=status_message chars=#{params[:status_message][:text].length}")
photos = Photo.where(:id => [*params[:photos]], :diaspora_handle => current_user.person.diaspora_handle)
if !photos.empty?
@status_message.photos << photos
end
aspects = current_user.aspects_from_ids(params[:aspect_ids])
current_user.add_to_streams(@status_message, aspects)
receiving_services = current_user.services.where( :type => params[:services].map{|s| "Services::"+s.titleize}) if params[:services]
@ -64,6 +64,9 @@ class StatusMessagesController < ApplicationController
format.mobile{ redirect_to root_url}
end
else
unless photos.empty?
photos.update_all(:status_message_guid => nil)
end
respond_to do |format|
format.js {