Browse Source

Send journal notification after commit (#25794).

git-svn-id: http://svn.redmine.org/redmine/trunk@16573 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.4.0
Jean-Philippe Lang 7 years ago
parent
commit
9439cae70f

+ 2
- 0
Gemfile View File

@@ -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"

+ 1
- 1
app/models/journal.rb View File

@@ -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

+ 1
- 1
app/views/mailer/issue_edit.html.erb View File

@@ -4,7 +4,7 @@
<%= l(:text_issue_updated, :id => link_to("##{@issue.id}", @issue_url), :author => h(@journal.user)).html_safe %>
<hr />

<ul class="details">
<ul class="journal details">
<% details_to_strings(@journal_details, false, :only_path => false).each do |string| %>
<li><%= string %></li>
<% end %>

+ 7
- 0
test/functional/issues_controller_test.rb View File

@@ -3839,6 +3839,7 @@ class IssuesControllerTest < Redmine::ControllerTest

def test_put_update_with_attachment_deletion_should_create_a_single_journal
set_tmp_attachments_directory
ActionMailer::Base.deliveries.clear
@request.session[:user_id] = 2

journal = new_record(Journal) do
@@ -3853,6 +3854,12 @@ class IssuesControllerTest < Redmine::ControllerTest
end
assert_equal 'Removing attachments', journal.notes
assert_equal 2, journal.details.count

assert_select_email do
assert_select 'ul.journal.details li', 2
assert_select 'del', :text => 'error281.txt'
assert_select 'del', :text => 'changeset_iso8859-1.diff'
end
end

def test_put_update_with_attachment_deletion_and_failure_should_preserve_selected_attachments

Loading…
Cancel
Save