]> source.dussan.org Git - redmine.git/commitdiff
Include attachment filename in "File added" email notification subject (#41450).
authorGo MAEDA <maeda@farend.jp>
Sun, 20 Oct 2024 04:46:37 +0000 (04:46 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 20 Oct 2024 04:46:37 +0000 (04:46 +0000)
Patch by minoura makoto (user:minoura).

git-svn-id: https://svn.redmine.org/redmine/trunk@23148 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mailer.rb
config/locales/en.yml
config/locales/ja.yml
test/functional/files_controller_test.rb

index 10d2fe900bed0e784d47b485092b7dcfa639012b..b64e94991758b300606ad98a14296552169e6a55 100644 (file)
@@ -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
index 657297619eda3a28855e567c3fa2cf5b34d6b3e1..200bdcdfc5c922d632e9fbffb19d2718de3f80fa 100644 (file)
@@ -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
index 1faae3deb1f6187eda877267dec9fd30b8158da5..cd3f4ff6a61d88666552936980d4a56d596969bc 100644 (file)
@@ -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}件"
index 2f983e28793259f9495b2598e52aefbe5cfa4fde..4cc5c972b0ffab93af4fa2f5392bae5f26fe7f35 100644 (file)
@@ -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