Commit a6585d79 authored by maeda's avatar maeda

New setting to include the status changes in issue mail notifications subject (#13111).

Patch by Marius BALTEANU.


git-svn-id: https://svn.redmine.org/redmine/trunk@17907 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent c51c6b14
......@@ -77,8 +77,11 @@ class Mailer < ActionMailer::Base
@issue = issue
@user = user
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}]"
subject << " (#{issue.status.name})" if Setting.show_status_changes_in_mail_subject?
subject << " #{issue.subject}"
mail :to => user,
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
:subject => subject
end
# Notifies users about a new issue.
......@@ -103,7 +106,7 @@ class Mailer < ActionMailer::Base
references issue
@author = journal.user
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << "(#{issue.status.name}) " if journal.new_value_for('status_id') && Setting.show_status_changes_in_mail_subject?
s << issue.subject
@issue = issue
@user = user
......
......@@ -7,6 +7,8 @@
<p><%= setting_check_box :bcc_recipients %></p>
<p><%= setting_check_box :plain_text_mail %></p>
<p><%= setting_check_box :show_status_changes_in_mail_subject %></p>
</div>
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
......
......@@ -472,6 +472,7 @@ en:
setting_timelog_accept_0_hours: Accept time logs with 0 hours
setting_timelog_max_hours_per_day: Maximum hours that can be logged per day and user
setting_timelog_accept_future_dates: Accept time logs on future dates
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject
permission_add_project: Create project
permission_add_subprojects: Create subprojects
......
......@@ -310,3 +310,5 @@ timelog_max_hours_per_day:
default: 999
timelog_accept_future_dates:
default: 1
show_status_changes_in_mail_subject:
default: 1
\ No newline at end of file
......@@ -422,6 +422,50 @@ class MailerTest < ActiveSupport::TestCase
end
end
def test_issue_add_subject_should_include_status_if_setting_is_enabled
with_settings :show_status_changes_in_mail_subject => 1 do
issue = Issue.find(2)
Mailer.deliver_issue_add(issue)
mail = last_email
assert_equal "[eCookbook - Feature request #2] (Assigned) Add ingredients categories", mail.subject
end
end
def test_issue_add_subject_should_not_include_status_if_setting_is_disabled
with_settings :show_status_changes_in_mail_subject => 0 do
issue = Issue.find(2)
Mailer.deliver_issue_add(issue)
mail = last_email
assert_equal "[eCookbook - Feature request #2] Add ingredients categories", mail.subject
end
end
def test_issue_edit_subject_should_include_status_changes_if_setting_is_enabled
with_settings :show_status_changes_in_mail_subject => 1 do
issue = Issue.find(2)
issue.status_id = 4
issue.save!
Mailer.deliver_issue_add(issue)
mail = last_email
assert_equal "[eCookbook - Feature request #2] (Feedback) Add ingredients categories", mail.subject
end
end
def test_issue_edit_subject_should_not_include_status_changes_if_setting_is_disabled
with_settings :show_status_changes_in_mail_subject => 0 do
issue = Issue.find(2)
issue.status_id = 4
issue.save!
Mailer.deliver_issue_add(issue)
mail = last_email
assert_equal "[eCookbook - Feature request #2] Add ingredients categories", mail.subject
end
end
def test_issue_edit_should_send_private_notes_to_users_with_permission_only
journal = Journal.find(1)
journal.private_notes = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment