summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/journal.rb3
-rw-r--r--config/locales/en.yml1
-rw-r--r--lib/redmine/notifiable.rb1
-rw-r--r--test/unit/journal_observer_test.rb28
4 files changed, 30 insertions, 3 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 0e4517f09..6ee6d9461 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -308,7 +308,8 @@ class Journal < ActiveRecord::Base
(Setting.notified_events.include?('issue_note_added') && notes.present?) ||
(Setting.notified_events.include?('issue_status_updated') && new_status.present?) ||
(Setting.notified_events.include?('issue_assigned_to_updated') && detail_for_attribute('assigned_to_id').present?) ||
- (Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?)
+ (Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) ||
+ (Setting.notified_events.include?('issue_fixed_version_updated') && detail_for_attribute('fixed_version_id').present?)
)
Mailer.deliver_issue_edit(self)
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8fcc2262a..33bf510da 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -588,6 +588,7 @@ en:
label_issue_status_updated: Status updated
label_issue_assigned_to_updated: Assignee updated
label_issue_priority_updated: Priority updated
+ label_issue_fixed_version_updated: Target version updated
label_document: Document
label_document_new: New document
label_document_plural: Documents
diff --git a/lib/redmine/notifiable.rb b/lib/redmine/notifiable.rb
index bc65dbf07..dbb5de335 100644
--- a/lib/redmine/notifiable.rb
+++ b/lib/redmine/notifiable.rb
@@ -16,6 +16,7 @@ module Redmine
notifications << Notifiable.new('issue_status_updated', 'issue_updated')
notifications << Notifiable.new('issue_assigned_to_updated', 'issue_updated')
notifications << Notifiable.new('issue_priority_updated', 'issue_updated')
+ notifications << Notifiable.new('issue_fixed_version_updated', 'issue_updated')
notifications << Notifiable.new('news_added')
notifications << Notifiable.new('news_comment_added')
notifications << Notifiable.new('document_added')
diff --git a/test/unit/journal_observer_test.rb b/test/unit/journal_observer_test.rb
index 616916a6c..903773db3 100644
--- a/test/unit/journal_observer_test.rb
+++ b/test/unit/journal_observer_test.rb
@@ -22,12 +22,12 @@ require File.expand_path('../../test_helper', __FILE__)
class JournalObserverTest < ActiveSupport::TestCase
fixtures :issues, :issue_statuses, :journals, :journal_details, :projects,
:projects_trackers, :trackers, :enabled_modules, :enumerations,
- :users, :email_addresses, :roles, :members, :member_roles
+ :users, :user_preferences, :email_addresses, :roles, :members, :member_roles,
+ :versions
def setup
User.current = nil
ActionMailer::Base.deliveries.clear
- @journal = Journal.find 1
end
# context: issue_updated notified_events
@@ -174,4 +174,28 @@ class JournalObserverTest < ActiveSupport::TestCase
end
assert_equal 0, ActionMailer::Base.deliveries.size
end
+
+ def test_create_should_send_email_notification_with_issue_fixed_version_updated
+ with_settings :notified_events => %w(issue_fixed_version_updated) do
+ user = User.find_by_login('jsmith')
+ issue = issues(:issues_001)
+ issue.init_journal(user)
+ issue.fixed_version = versions(:versions_003)
+
+ assert issue.save
+ assert_equal 2, ActionMailer::Base.deliveries.size
+ end
+ end
+
+ def test_create_should_not_send_email_notification_without_issue_fixed_version_updated
+ with_settings :notified_events => [] do
+ user = User.find_by_login('jsmith')
+ issue = issues(:issues_001)
+ issue.init_journal(user)
+ issue.fixed_version = versions(:versions_003)
+
+ assert issue.save
+ assert_equal 0, ActionMailer::Base.deliveries.size
+ end
+ end
end