diff options
author | Go MAEDA <maeda@farend.jp> | 2020-01-21 04:23:26 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-01-21 04:23:26 +0000 |
commit | d48769f152ffbfa7203889c6c08e6bb0591e3ab3 (patch) | |
tree | 010840b0a332949a182339eb50f6b99455ee78ea /test/unit/issue_test.rb | |
parent | d438c89b1a986176bf9fa6e5bb4dab6a1f4ee8e1 (diff) | |
download | redmine-d48769f152ffbfa7203889c6c08e6bb0591e3ab3.tar.gz redmine-d48769f152ffbfa7203889c6c08e6bb0591e3ab3.zip |
Enable users to receive email notifications about high issues (only) (#32628).
Patch by Jan Schulz-Hofen.
git-svn-id: http://svn.redmine.org/redmine/trunk@19449 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r-- | test/unit/issue_test.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 3203e2a3f..346208d00 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -2928,6 +2928,47 @@ class IssueTest < ActiveSupport::TestCase assert !issue.recipients.include?(issue.assigned_to.mail) end + test "Issue#recipients should include users who want to be notified about high issues but only when issue has high priority" do + user = User.generate! + user.pref.update! notify_about_high_priority_issues: true + Member.create!(:project_id => 1, :principal => user, :role_ids => [1]) + + # creation with high prio + issue = Issue.generate!(priority: IssuePriority.find(6)) + assert issue.recipients.include?(user.mail) + + # creation with default prio + issue = Issue.generate! + assert !issue.recipients.include?(user.mail) + + # update prio to high + issue.update! priority: IssuePriority.find(6) + assert issue.recipients.include?(user.mail) + + # update prio to low + issue.update! priority: IssuePriority.find(4) + assert !issue.recipients.include?(user.mail) + end + + test "Authors who don't want to be self-notified should not receive emails even when issue has high priority" do + user = User.generate! + user.pref.update! notify_about_high_priority_issues: true + user.pref.update! no_self_notified: true + + project = Project.find(1) + project.memberships.destroy_all + Member.create!(:project_id => 1, :principal => user, :role_ids => [1]) + + ActionMailer::Base.deliveries.clear + Issue.create(author: user, + priority: IssuePriority.find(6), + subject: 'test create', + project: project, + tracker: Tracker.first, + status: IssueStatus.first) + assert ActionMailer::Base.deliveries.empty? + end + def test_last_journal_id_with_journals_should_return_the_journal_id assert_equal 2, Issue.find(1).last_journal_id end |