From 9439cae70fab58b8cafdd753aa83135d4279345d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 27 May 2017 08:44:24 +0000 Subject: [PATCH] Send journal notification after commit (#25794). git-svn-id: http://svn.redmine.org/redmine/trunk@16573 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- Gemfile | 2 ++ app/models/journal.rb | 2 +- app/views/mailer/issue_edit.html.erb | 2 +- test/functional/issues_controller_test.rb | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 018be1d4e..ccfc7633c 100644 --- a/Gemfile +++ b/Gemfile @@ -91,6 +91,8 @@ group :test do gem "rails-dom-testing" gem "mocha" gem "simplecov", "~> 0.9.1", :require => false + # TODO: remove this after upgrading to Rails 5 + gem "test_after_commit" # For running UI tests gem "capybara" gem "selenium-webdriver", "~> 2.53.4" diff --git a/app/models/journal.rb b/app/models/journal.rb index 7d1a6eb34..369666b6f 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -43,7 +43,7 @@ class Journal < ActiveRecord::Base " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')").distinct before_create :split_private_notes - after_create :send_notification + after_commit :send_notification, :on => :create scope :visible, lambda {|*args| user = args.shift || User.current diff --git a/app/views/mailer/issue_edit.html.erb b/app/views/mailer/issue_edit.html.erb index d84f44923..b7fc18ed6 100644 --- a/app/views/mailer/issue_edit.html.erb +++ b/app/views/mailer/issue_edit.html.erb @@ -4,7 +4,7 @@ <%= l(:text_issue_updated, :id => link_to("##{@issue.id}", @issue_url), :author => h(@journal.user)).html_safe %>
-