diff options
author | Go MAEDA <maeda@farend.jp> | 2020-02-11 02:34:25 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-02-11 02:34:25 +0000 |
commit | dec5f98112331caa229abd7b74e59d71aff3d9e2 (patch) | |
tree | 47e84ea93a60586fd48665e4a8ecbaae38c0d352 /app/controllers/messages_controller.rb | |
parent | b6d26dc1700c485183351af52e275da4b1a759f8 (diff) | |
download | redmine-dec5f98112331caa229abd7b74e59d71aff3d9e2.tar.gz redmine-dec5f98112331caa229abd7b74e59d71aff3d9e2.zip |
Include attachments in forum post notifications (#16006).
Patch by Yuichi HARADA.
git-svn-id: http://svn.redmine.org/redmine/trunk@19506 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/messages_controller.rb')
-rw-r--r-- | app/controllers/messages_controller.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index bbc6a35d4..2a0e341b6 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -77,10 +77,10 @@ class MessagesController < ApplicationController @reply.author = User.current @reply.board = @board @reply.safe_attributes = params[:reply] + @reply.save_attachments(params[:attachments]) @topic.children << @reply if !@reply.new_record? call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) - attachments = Attachment.attach_files(@reply, params[:attachments]) render_attachment_warning_if_needed(@reply) end flash[:notice] = l(:notice_successful_update) @@ -91,12 +91,14 @@ class MessagesController < ApplicationController def edit (render_403; return false) unless @message.editable_by?(User.current) @message.safe_attributes = params[:message] - if request.post? && @message.save - attachments = Attachment.attach_files(@message, params[:attachments]) - render_attachment_warning_if_needed(@message) - flash[:notice] = l(:notice_successful_update) - @message.reload - redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + if request.post? + @message.save_attachments(params[:attachments]) + if @message.save + render_attachment_warning_if_needed(@message) + flash[:notice] = l(:notice_successful_update) + @message.reload + redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + end end end |