gitlab-org--gitlab-foss/lib/additional_email_headers_interceptor.rb
Sean McGivern eddc9e41a6 Only set Auto-Submitted header once
The emails on push feature reuses the same email object, to avoid the expensive
work of generating the email body.

This interceptor would previously set multiple values for the same header, as
that's the mail gem's default behaviour when called with the same header more
than once.

We don't want to change the emails on push service (although it's the only place
where this happens), but fixing the interceptor is just as sensible anyway.
2017-10-30 13:50:19 +00:00

6 lines
202 B
Ruby

class AdditionalEmailHeadersInterceptor
def self.delivering_email(message)
message.header['Auto-Submitted'] ||= 'auto-generated'
message.header['X-Auto-Response-Suppress'] ||= 'All'
end
end