Feature #41031 » 41031-experimental.patch
app/models/mailer.rb | ||
---|---|---|
670 | 670 |
@author&.logged? ? @author.name : Setting.app_title |
671 | 671 |
end |
672 | 672 |
from = mail_from.format |
673 |
list_id = "<#{mail_from.address.to_s.tr('@', '.')}>"
|
|
673 |
from_addr = mail_from.address.to_s
|
|
674 | 674 |
rescue Mail::Field::IncompleteParseError |
675 | 675 |
# Use Setting.mail_from as it is if Mail::Address cannot parse it |
676 | 676 |
# (probably the emission address is not RFC compliant) |
677 | 677 |
from = Setting.mail_from.to_s |
678 |
list_id = "<#{from.tr('@', '.')}>"
|
|
678 |
from_addr = from
|
|
679 | 679 |
end |
680 | 680 | |
681 |
project_identifier = |
|
682 |
Setting.include_project_in_list_id? ? self.headers['X-Redmine-Project']&.value : nil |
|
683 |
list_id = "<#{[project_identifier, from_addr.tr('@', '.')].compact.join('.')}>" |
|
684 | ||
681 | 685 |
headers.reverse_merge! 'X-Mailer' => 'Redmine', |
682 | 686 |
'X-Redmine-Host' => Setting.host_name, |
683 | 687 |
'X-Redmine-Site' => Setting.app_title, |
app/views/settings/_notifications.html.erb | ||
---|---|---|
7 | 7 |
<p><%= setting_check_box :plain_text_mail %></p> |
8 | 8 | |
9 | 9 |
<p><%= setting_check_box :show_status_changes_in_mail_subject %></p> |
10 | ||
11 |
<p><%= setting_check_box :include_project_in_list_id %></p> |
|
10 | 12 |
</div> |
11 | 13 | |
12 | 14 |
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> |
config/locales/en.yml | ||
---|---|---|
521 | 521 |
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject |
522 | 522 |
setting_project_list_defaults: Projects list defaults |
523 | 523 |
setting_twofa: Two-factor authentication |
524 |
setting_include_project_in_list_id: Include project identifier in List-Id header |
|
524 | 525 | |
525 | 526 |
permission_add_project: Create project |
526 | 527 |
permission_add_subprojects: Create subprojects |
config/settings.yml | ||
---|---|---|
349 | 349 |
default: 1 |
350 | 350 |
show_status_changes_in_mail_subject: |
351 | 351 |
default: 1 |
352 |
include_project_in_list_id: |
|
353 |
default: 1 |
test/unit/mailer_test.rb | ||
---|---|---|
220 | 220 |
assert_equal 'All', mail.header['X-Auto-Response-Suppress'].to_s |
221 | 221 |
assert_equal 'auto-generated', mail.header['Auto-Submitted'].to_s |
222 | 222 |
# List-Id should not include the display name "Redmine" |
223 |
assert_equal '<redmine.example.net>', mail.header['List-Id'].to_s |
|
223 |
assert_equal '<ecookbook.redmine.example.net>', mail.header['List-Id'].to_s
|
|
224 | 224 |
assert_equal 'Bug', mail.header['X-Redmine-Issue-Tracker'].to_s |
225 | 225 |
assert_equal 'Low', mail.header['X-Redmine-Issue-Priority'].to_s |
226 | 226 |
end |