From ea7bdfde28a05b838ddce77bf075163fb4b83ee8 Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 19 Nov 2010 18:49:16 -0800 Subject: [PATCH] fix validation and order of status message sent --- app/controllers/status_messages_controller.rb | 5 +++-- app/models/photo.rb | 8 ++++++-- app/views/layouts/application.html.haml | 2 +- config/deploy_config.yml | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index c4a796462..4a0c358bc 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -16,15 +16,16 @@ class StatusMessagesController < ApplicationController params[:status_message][:public] = public_flag @status_message = current_user.build_post(:status_message, params[:status_message]) + if @status_message.save(:safe => true) raise 'MongoMapper failed to catch a failed save' unless @status_message.id + current_user.dispatch_post(@status_message, :to => params[:status_message][:to]) + @status_message.photos += photos unless photos.nil? for photo in photos current_user.dispatch_post(photo, :to => params[:status_message][:to]) end - - current_user.dispatch_post(@status_message, :to => params[:status_message][:to]) end render :nothing => true diff --git a/app/models/photo.rb b/app/models/photo.rb index fc637c284..87cf24068 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -25,9 +25,13 @@ class Photo < Post before_destroy :ensure_user_picture + def ownership_of_status_message - if status_message_id - self.diaspora_handle == StatusMessage.find_by_id(self.status_message_id).diaspora_handle + message = StatusMessage.find_by_id(self.status_message_id) + if status_message_id && message + self.diaspora_handle == message.diaspora_handle + else + true end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c073ea9bf..645e48b72 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,7 +11,7 @@ - if current_user = "#{current_user.real_name} | DIASPORA*" - else - DIASPORA + DIASPORA* %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'} diff --git a/config/deploy_config.yml b/config/deploy_config.yml index 06a6747e1..6538e273c 100644 --- a/config/deploy_config.yml +++ b/config/deploy_config.yml @@ -6,7 +6,7 @@ cross_server: deploy_to: '/usr/local/app/diaspora' user: 'root' repo: 'git://github.com/diaspora/diaspora.git' - branch: 'master' + branch: 'homepage' default_env: 'development' servers: tom: