diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-02 19:26:03 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-02 19:26:03 +0000 |
commit | 0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd (patch) | |
tree | d2e93da10c1c871b04783dccfd56f92ec0ef502a /app/controllers/messages_controller.rb | |
parent | 81d617cd5b97a811503282a5a5d056fa5b3adc0f (diff) | |
download | redmine-0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd.tar.gz redmine-0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd.zip |
Refactor: Moved ApplicationController#attach_files to the Attachment model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3523 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/messages_controller.rb')
-rw-r--r-- | app/controllers/messages_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index bab0e1e19..70226a711 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -62,7 +62,8 @@ class MessagesController < ApplicationController end if request.post? && @message.save call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) - attach_files(@message, params[:attachments]) + attachments = Attachment.attach_files(@message, params[:attachments]) + flash[:warning] = attachments[:flash] if attachments[:flash] redirect_to :action => 'show', :id => @message end end @@ -75,7 +76,8 @@ class MessagesController < ApplicationController @topic.children << @reply if !@reply.new_record? call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) - attach_files(@reply, params[:attachments]) + attachments = Attachment.attach_files(@reply, params[:attachments]) + flash[:warning] = attachments[:flash] if attachments[:flash] end redirect_to :action => 'show', :id => @topic, :r => @reply end @@ -88,7 +90,8 @@ class MessagesController < ApplicationController @message.sticky = params[:message]['sticky'] end if request.post? && @message.update_attributes(params[:message]) - attach_files(@message, params[:attachments]) + attachments = Attachment.attach_files(@message, params[:attachments]) + flash[:warning] = attachments[:flash] if attachments[:flash] 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) |