summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-10-20 04:46:37 +0000
committerGo MAEDA <maeda@farend.jp>2024-10-20 04:46:37 +0000
commit95add1af5cb34f50af4aacb2e6064ab75346a411 (patch)
tree0eb6ae49a1846790eb572940f6a7b220cbbcf651
parentdaa18f5c381b6ecf2df674f7de2733ea9a3a31e7 (diff)
downloadredmine-95add1af5cb34f50af4aacb2e6064ab75346a411.tar.gz
redmine-95add1af5cb34f50af4aacb2e6064ab75346a411.zip
Include attachment filename in "File added" email notification subject (#41450).
Patch by minoura makoto (user:minoura). git-svn-id: https://svn.redmine.org/redmine/trunk@23148 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/mailer.rb5
-rw-r--r--config/locales/en.yml4
-rw-r--r--config/locales/ja.yml3
-rw-r--r--test/functional/files_controller_test.rb2
4 files changed, 12 insertions, 2 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 10d2fe900..b64e94991 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -187,13 +187,16 @@ class Mailer < ActionMailer::Base
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
added_to = "#{l(:label_document)}: #{container.title}"
end
+ summary = l(:label_attachment_summary,
+ :filename => attachments.first.filename,
+ :count => attachments.length - 1)
redmine_headers 'Project' => container.project.identifier
@attachments = attachments
@user = user
@added_to = added_to
@added_to_url = added_to_url
mail :to => user,
- :subject => "[#{container.project.name}] #{l(:label_attachment_new)}"
+ :subject => "[#{container.project.name}] #{l(:label_attachment_new)}: #{summary}"
end
# Notifies users about new attachments
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 657297619..200bdcdfc 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -717,6 +717,10 @@ en:
label_attachment_plural: Files
label_file_added: File added
label_attachment_description: File description
+ label_attachment_summary:
+ zero: "%{filename}"
+ one: "%{filename} and 1 file"
+ other: "%{filename} and %{count} files"
label_report: Report
label_report_plural: Reports
label_news: News
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 1faae3deb..cd3f4ff6a 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -1446,3 +1446,6 @@ ja:
setting_copy_attachments_on_issue_copy: チケットをコピーするとき添付ファイルもコピー
field_thousands_delimiter: 3桁区切り表示
label_involved_principals: 作成者 / 直前担当者
+ label_attachment_summary:
+ zero: "%{filename}"
+ other: "%{filename} ほか%{count}件"
diff --git a/test/functional/files_controller_test.rb b/test/functional/files_controller_test.rb
index 2f983e287..4cc5c972b 100644
--- a/test/functional/files_controller_test.rb
+++ b/test/functional/files_controller_test.rb
@@ -107,7 +107,7 @@ class FilesControllerTest < Redmine::ControllerTest
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
- assert_equal "[eCookbook] New file", mail.subject
+ assert_equal '[eCookbook] New file: testfile.txt', mail.subject
assert_mail_body_match 'testfile.txt', mail
end