From 959b55779f0188b5fd59b7990200df10ffc6d4d4 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 25 Aug 2019 00:09:10 +0000 Subject: [PATCH] Fix hard-coded string "no subject" in app/models/mail_handler.rb (#5820). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@18388 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/mail_handler.rb | 2 +- config/locales/en.yml | 1 + test/unit/mail_handler_test.rb | 14 ++++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 2aaa8bbf0..f0f0f41b1 100755 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -199,7 +199,7 @@ class MailHandler < ActionMailer::Base issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)} issue.subject = cleaned_up_subject if issue.subject.blank? - issue.subject = '(no subject)' + issue.subject = "(#{ll(Setting.default_language, :text_no_subject)})" end issue.description = cleaned_up_text_body issue.start_date ||= User.current.today if Setting.default_issue_start_date_to_creation_date? diff --git a/config/locales/en.yml b/config/locales/en.yml index 262ad1ba4..b4f37f0b7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1218,6 +1218,7 @@ en: text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item." text_select_apply_tracker: "Select tracker" text_avatar_server_config_html: The current avatar server is %{url}. You can configure it in config/configuration.yml. + text_no_subject: no subject default_role_manager: Manager diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 469722a37..758f5f6e8 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -738,12 +738,14 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_add_issue_with_no_subject_header - issue = submit_email( - 'no_subject_header.eml', - :issue => {:project => 'ecookbook'} - ) - assert_kind_of Issue, issue - assert_equal '(no subject)', issue.subject + with_settings :default_language => 'en' do + issue = submit_email( + 'no_subject_header.eml', + :issue => {:project => 'ecookbook'} + ) + assert_kind_of Issue, issue + assert_equal "(no subject)", issue.subject + end end def test_add_issue_with_mixed_japanese_subject -- 2.39.5