Last active
January 1, 2016 10:19
-
-
Save superdaigo/8131115 to your computer and use it in GitHub Desktop.
Redmine 2.3-stable: Append project identifier into mail header 'List-ID'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/models/mailer.rb b/app/models/mailer.rb | |
index c12195a..9819776 100644 | |
--- a/app/models/mailer.rb | |
+++ b/app/models/mailer.rb | |
@@ -388,6 +388,31 @@ class Mailer < ActionMailer::Base | |
'From' => Setting.mail_from, | |
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>" | |
+ # set List-ID | |
+ if @issue | |
+ project_id = @issue.project.identifier | |
+ end | |
+ if @document | |
+ project_id = @document.project.identifier | |
+ end | |
+ if @attachments | |
+ project_id = @attachments.first.container.project.identifier | |
+ end | |
+ if @news | |
+ project_id = @news.project.identifier | |
+ end | |
+ if @message | |
+ project_id = @message.project.identifier | |
+ end | |
+ if @wiki_content | |
+ project_id = @wiki_content.project.identifier | |
+ end | |
+ if project_id | |
+ headers 'List-ID' => "#{Setting.host_name}/#{project_id}" | |
+ else | |
+ headers 'List-ID' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>" | |
+ end | |
+ | |
# Removes the author from the recipients and cc | |
# if he doesn't want to receive notifications about what he does | |
if @author && @author.logged? && @author.pref.no_self_notified |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment