Project

General

Profile

Feature #41031 » 41031-experimental.patch

Go MAEDA, 2024-07-17 16:26

View differences:

app/models/mailer.rb
@author&.logged? ? @author.name : Setting.app_title
end
from = mail_from.format
list_id = "<#{mail_from.address.to_s.tr('@', '.')}>"
from_addr = mail_from.address.to_s
rescue Mail::Field::IncompleteParseError
# Use Setting.mail_from as it is if Mail::Address cannot parse it
# (probably the emission address is not RFC compliant)
from = Setting.mail_from.to_s
list_id = "<#{from.tr('@', '.')}>"
from_addr = from
end
project_identifier =
Setting.include_project_in_list_id? ? self.headers['X-Redmine-Project']&.value : nil
list_id = "<#{[project_identifier, from_addr.tr('@', '.')].compact.join('.')}>"
headers.reverse_merge! 'X-Mailer' => 'Redmine',
'X-Redmine-Host' => Setting.host_name,
'X-Redmine-Site' => Setting.app_title,
app/views/settings/_notifications.html.erb
<p><%= setting_check_box :plain_text_mail %></p>
<p><%= setting_check_box :show_status_changes_in_mail_subject %></p>
<p><%= setting_check_box :include_project_in_list_id %></p>
</div>
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
config/locales/en.yml
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject
setting_project_list_defaults: Projects list defaults
setting_twofa: Two-factor authentication
setting_include_project_in_list_id: Include project identifier in List-Id header
permission_add_project: Create project
permission_add_subprojects: Create subprojects
config/settings.yml
default: 1
show_status_changes_in_mail_subject:
default: 1
include_project_in_list_id:
default: 1
test/unit/mailer_test.rb
assert_equal 'All', mail.header['X-Auto-Response-Suppress'].to_s
assert_equal 'auto-generated', mail.header['Auto-Submitted'].to_s
# List-Id should not include the display name "Redmine"
assert_equal '<redmine.example.net>', mail.header['List-Id'].to_s
assert_equal '<ecookbook.redmine.example.net>', mail.header['List-Id'].to_s
assert_equal 'Bug', mail.header['X-Redmine-Issue-Tracker'].to_s
assert_equal 'Low', mail.header['X-Redmine-Issue-Priority'].to_s
end
(1-1/2)