From 4b55bb913c48db9ccd1413875f52ea4b5e21a503 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 2 Jul 2014 16:13:18 +0000 Subject: [PATCH] only ignore undesirable Auto-Submitted headers defined in RFC3834 (#16190) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Contributed by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@13206 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/mail_handler.rb | 2 +- test/unit/mail_handler_test.rb | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 1b4600536..2e25a294f 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -74,7 +74,7 @@ class MailHandler < ActionMailer::Base cattr_accessor :ignored_emails_headers @@ignored_emails_headers = { 'X-Auto-Response-Suppress' => 'oof', - 'Auto-Submitted' => /^auto-/ + 'Auto-Submitted' => /^auto-(replied|generated)/ } # Processes incoming emails diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 507ca1e85..6c3aefc41 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -637,8 +637,7 @@ class MailHandlerTest < ActiveSupport::TestCase "X-Auto-Response-Suppress: OOF", "Auto-Submitted: auto-replied", "Auto-Submitted: Auto-Replied", - "Auto-Submitted: auto-generated", - "Auto-Submitted: auto-forwarded" + "Auto-Submitted: auto-generated" ].each do |header| raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) raw = header + "\n" + raw @@ -649,6 +648,19 @@ class MailHandlerTest < ActiveSupport::TestCase end end + test "should not ignore Auto-Submitted headers not defined in RFC3834" do + [ + "Auto-Submitted: auto-forwarded" + ].each do |header| + raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) + raw = header + "\n" + raw + + assert_difference 'Issue.count', 1 do + assert_not_nil MailHandler.receive(raw), "email with #{header} header was ignored" + end + end + end + def test_add_issue_should_send_email_notification Setting.notified_events = ['issue_added'] ActionMailer::Base.deliveries.clear -- 2.39.5