summaryrefslogtreecommitdiffstats
path: root/app/controllers/messages_controller.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-03-03 17:05:00 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-03-03 17:05:00 +0000
commitfe1e3ccd18420752979d817fac4408c780ba1da2 (patch)
treed7c9bbda24e92c5180c8c8f4adeb03c77c3493d8 /app/controllers/messages_controller.rb
parent44955a519c77abe09e9706135a0443761604c780 (diff)
downloadredmine-fe1e3ccd18420752979d817fac4408c780ba1da2.tar.gz
redmine-fe1e3ccd18420752979d817fac4408c780ba1da2.zip
Refactor: Decouple failed attachments and the flash messages
Attachment#attach_files will no longer need to return a flash message, instead it will put unsaved attachments into object#unsaved_attachments where the calling object can access them. A utility method #render_attachment_warning_if_needed is included for setting the standard flash warning. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/messages_controller.rb')
-rw-r--r--app/controllers/messages_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 70226a711..5ad8ea58d 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -63,7 +63,7 @@ class MessagesController < ApplicationController
if request.post? && @message.save
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
attachments = Attachment.attach_files(@message, params[:attachments])
- flash[:warning] = attachments[:flash] if attachments[:flash]
+ render_attachment_warning_if_needed(@message)
redirect_to :action => 'show', :id => @message
end
end
@@ -77,7 +77,7 @@ class MessagesController < ApplicationController
if !@reply.new_record?
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
- flash[:warning] = attachments[:flash] if attachments[:flash]
+ render_attachment_warning_if_needed(@reply)
end
redirect_to :action => 'show', :id => @topic, :r => @reply
end
@@ -91,7 +91,7 @@ class MessagesController < ApplicationController
end
if request.post? && @message.update_attributes(params[:message])
attachments = Attachment.attach_files(@message, params[:attachments])
- flash[:warning] = attachments[:flash] if attachments[:flash]
+ render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update)
@message.reload
redirect_to :action => 'show', :board_id => @message.board, :id => @message.root, :r => (@message.parent_id && @message.id)