diff options
author | Go MAEDA <maeda@farend.jp> | 2018-12-15 21:40:09 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-12-15 21:40:09 +0000 |
commit | 7d827b1389bf91679c1bcfaacae79fea65e03f12 (patch) | |
tree | 7f5bce8079a8d715aee3199f41c9317ca96b62ac | |
parent | 10eba2878a518d776c1b8f48b810f74fa7a0530d (diff) | |
download | redmine-7d827b1389bf91679c1bcfaacae79fea65e03f12.tar.gz redmine-7d827b1389bf91679c1bcfaacae79fea65e03f12.zip |
Display notice on forum updates (#2635).
Patch by Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@17738 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/messages_controller.rb | 3 | ||||
-rw-r--r-- | test/functional/messages_controller_test.rb | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 0ba360e9a..99dda31fd 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -63,6 +63,7 @@ class MessagesController < ApplicationController if @message.save call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) render_attachment_warning_if_needed(@message) + flash[:notice] = l(:notice_successful_create) redirect_to board_message_path(@board, @message) end end @@ -80,6 +81,7 @@ class MessagesController < ApplicationController attachments = Attachment.attach_files(@reply, params[:attachments]) render_attachment_warning_if_needed(@reply) end + flash[:notice] = l(:notice_successful_update) redirect_to board_message_path(@board, @topic, :r => @reply) end @@ -101,6 +103,7 @@ class MessagesController < ApplicationController (render_403; return false) unless @message.destroyable_by?(User.current) r = @message.to_param @message.destroy + flash[:notice] = l(:notice_successful_delete) if @message.parent redirect_to board_message_path(@board, @message.parent, :r => r) else diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb index b129cdd33..715258fe1 100644 --- a/test/functional/messages_controller_test.rb +++ b/test/functional/messages_controller_test.rb @@ -129,6 +129,7 @@ class MessagesControllerTest < Redmine::ControllerTest } } end + assert_equal I18n.t(:notice_successful_create), flash[:notice] message = Message.find_by_subject('Test created message') assert_not_nil message assert_redirected_to "/boards/1/topics/#{message.to_param}" @@ -171,6 +172,7 @@ class MessagesControllerTest < Redmine::ControllerTest } } assert_redirected_to '/boards/1/topics/1' + assert_equal I18n.t(:notice_successful_update), flash[:notice] message = Message.find(1) assert_equal 'New subject', message.subject assert_equal 'New body', message.content @@ -189,6 +191,7 @@ class MessagesControllerTest < Redmine::ControllerTest } } assert_redirected_to '/boards/1/topics/1' + assert_equal I18n.t(:notice_successful_update), flash[:notice] message = Message.find(1) assert_equal true, message.sticky? assert_equal true, message.locked? @@ -222,6 +225,7 @@ class MessagesControllerTest < Redmine::ControllerTest } reply = Message.order('id DESC').first assert_redirected_to "/boards/1/topics/1?r=#{reply.id}" + assert_equal I18n.t(:notice_successful_update), flash[:notice] assert Message.find_by_subject('Test reply') end @@ -234,6 +238,7 @@ class MessagesControllerTest < Redmine::ControllerTest } end assert_redirected_to '/projects/ecookbook/boards/1' + assert_equal I18n.t(:notice_successful_delete), flash[:notice] assert_nil Message.find_by_id(1) end @@ -246,6 +251,7 @@ class MessagesControllerTest < Redmine::ControllerTest } end assert_redirected_to '/boards/1/topics/1?r=2' + assert_equal I18n.t(:notice_successful_delete), flash[:notice] assert_nil Message.find_by_id(2) end |