FIX: Remove List-Unsubscribe header if using group SMTP (#13448)

The other mailing list headers were removed if using
group SMTP in ff6114d83f
This commit is contained in:
Martin Brennan 2021-06-21 09:33:32 +10:00 committed by GitHub
parent 497aae062a
commit f0c10edd28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -492,6 +492,7 @@ class UserNotifications < ActionMailer::Base
from_address = nil
delivery_method_options = nil
use_from_address_for_reply_to = false
using_group_smtp = false
template = +"user_notifications.user_#{notification_type}"
if post.topic.private_message?
@ -562,6 +563,7 @@ class UserNotifications < ActionMailer::Base
# will forward the email back into Discourse and process/link it correctly.
use_from_address_for_reply_to = true
from_address = group.email_username
using_group_smtp = true
end
if post.topic.private_message?
@ -711,7 +713,8 @@ class UserNotifications < ActionMailer::Base
locale: locale,
delivery_method_options: delivery_method_options,
use_from_address_for_reply_to: use_from_address_for_reply_to,
from: from_address
from: from_address,
add_unsubscribe_link: !using_group_smtp
}
unless translation_override_exists

View File

@ -375,6 +375,7 @@ describe Email::Sender do
expect(message.header['List-Post']).to eq(nil)
expect(message.header['List-Archive']).to eq(nil)
expect(message.header['Precedence']).to eq(nil)
expect(message.header['List-Unsubscribe']).to eq(nil)
end
end
end