Commit ffa4ab30 authored by ng's avatar ng

Merge branch 'cherry-pick-jenkins-on-master' into 'master'

Cherry pick jenkins on master

See merge request !306
parents ea92aa25 573ad19a
Pipeline #32708 passed with stages
in 12 minutes and 30 seconds
......@@ -3,6 +3,12 @@ Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## [3.4.x]
### Fixed
* Allow Jenkins job notifications to reach lists. Before, such mails were rejected due to being "auto-submitted".
## [3.4.1] / 2019-09-16
### Fixed
......
......@@ -206,11 +206,14 @@ module Mail
@recipient.match(/-bounce@/).present? ||
# Empty Return-Path
self.return_path.to_s == '<>' ||
# Auto-Submitted exists and does not equal 'no' and no cron header
# present, as cron emails have the auto-submitted header.
# Auto-Submitted exists and does not equal 'no' and:
# - no cron header is present
# - no Jenkins job notification header is present
# as these emails have the auto-submitted header.
( self['Auto-Submitted'].present? && \
self['Auto-Submitted'].to_s.downcase != 'no' && \
!self['X-Cron-Env'].present?)
!self['X-Cron-Env'].present? && \
!self['X-Jenkins-Job'].present?)
end
def keywords
......
......@@ -54,6 +54,18 @@ describe Mail::Message do
expect(mail.automated_message?).to be(false)
end
it "recognizes a Jenkins message with 'Auto-Submitted'-header NOT as automated message" do
list = create(:list)
mail = Mail.new
mail.header['Auto-submitted'] = 'auto-generated'
mail.header['X-Jenkins-Job'] = 'test_Tails_ISO_stable'
# Trigger the setting of mandatory headers.
mail.to_s
mail = Mail.create_message_to_list(mail.to_s, 'something@localhost', list).setup
expect(mail.automated_message?).to be(false)
end
context '#add_subject_prefix!' do
it 'adds a configured subject prefix' do
list = create(:list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment