Commit bc6eee11 authored by Nina's avatar Nina

Merge branch 'admin-notifications-add-list-id-header' into 'master'

Add missing List-Id header to notification mails sent to admins

See merge request schleuder/schleuder!312
parents 0a049c0c ee41fd42
Pipeline #33401 passed with stages
in 25 minutes and 28 seconds
......@@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Fixed using x-attach-listkey with emails from Thunderbird that include protected headers.
* Ensure ASCII-8BIT as external encoding, this should ensure that plain text emails in different charsets can be parsed (#409)
* Handle incoming mails encrypted to an absent key, using symmetric encryption or containing PGP-garbage in a more graceful manner: Don't throw an exception, don't notify (and annoy) the admins, instead inform the sender of the mail how to do better. (#337)
* Add missing List-Id header to notification mails sent to admins. This should help with filtering such messages, which is currently not easy to do in a reliable way.
## [3.4.1] / 2019-09-16
......
......@@ -42,6 +42,8 @@ module Schleuder
gpg_opts.merge!(encrypt: true, keys: { address => key.fingerprint })
end
mail.gpg gpg_opts
mail.header['List-Id'] = "<#{@list.email.gsub('@', '.')}>"
end
mail.deliver
end
......
......@@ -97,4 +97,16 @@ describe Schleuder::LoggerNotifications do
expect(message.parts.size).to be(2)
expect(message.parts.first.parts.first.body.to_s).to eql('Something')
end
it 'includes a List-Id header in notification mails sent to admins' do
list = create(:list, send_encrypted_only: false)
list.subscribe("schleuder@example.org", nil, true)
mail = Mail.new
list.logger.notify_admin("Something", mail.to_s, I18n.t('notice'))
message = Mail::TestMailer.deliveries.first
expect(message.header['List-Id'].to_s).to eql("<#{list.email.gsub('@', '.')}>")
end
end
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