##// END OF EJS Templates
Adds a X-Redmine-Sender header to email notifications (#5643)....
Jean-Philippe Lang -
r8665:967f42aa98f5
parent child
Show More
@@ -41,6 +41,7 class Mailer < ActionMailer::Base
41 'Issue-Author' => issue.author.login
41 'Issue-Author' => issue.author.login
42 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
42 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
43 message_id issue
43 message_id issue
44 @author = issue.author
44 recipients issue.recipients
45 recipients issue.recipients
45 cc(issue.watcher_recipients - @recipients)
46 cc(issue.watcher_recipients - @recipients)
46 subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
47 subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
@@ -394,6 +395,10 class Mailer < ActionMailer::Base
394 cc.delete(@author.mail) if cc
395 cc.delete(@author.mail) if cc
395 end
396 end
396
397
398 if @author.logged?
399 redmine_headers 'Sender' => @author.login
400 end
401
397 notified_users = [recipients, cc].flatten.compact.uniq
402 notified_users = [recipients, cc].flatten.compact.uniq
398 # Rails would log recipients only, not cc and bcc
403 # Rails would log recipients only, not cc and bcc
399 mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
404 mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
@@ -138,6 +138,14 class MailerTest < ActiveSupport::TestCase
138 assert_equal 'auto-generated', mail.header_string('Auto-Submitted')
138 assert_equal 'auto-generated', mail.header_string('Auto-Submitted')
139 end
139 end
140
140
141 def test_email_headers_should_include_sender
142 issue = Issue.find(1)
143 Mailer.deliver_issue_add(issue)
144 mail = ActionMailer::Base.deliveries.last
145 assert_not_nil mail
146 assert_equal issue.author.login, mail.header_string('X-Redmine-Sender')
147 end
148
141 def test_plain_text_mail
149 def test_plain_text_mail
142 Setting.plain_text_mail = 1
150 Setting.plain_text_mail = 1
143 journal = Journal.find(2)
151 journal = Journal.find(2)
General Comments 0
You need to be logged in to leave comments. Login now