mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 01:26:18 -05:00
FIX: 'List-Unsubscribe' header wasn't added to emails sent when mailing_list_mode was enabled
This commit is contained in:
parent
5b270b6b06
commit
829143bf88
2 changed files with 8 additions and 4 deletions
|
@ -83,9 +83,14 @@ class UserNotifications < ActionMailer::Base
|
|||
return unless @posts_by_topic.present?
|
||||
|
||||
build_summary_for(user)
|
||||
apply_notification_styles build_email @user.email,
|
||||
opts = {
|
||||
from_alias: I18n.t('user_notifications.mailing_list.from', site_name: SiteSetting.title),
|
||||
subject: I18n.t('user_notifications.mailing_list.subject_template', site_name: @site_name, date: @date)
|
||||
subject: I18n.t('user_notifications.mailing_list.subject_template', site_name: @site_name, date: @date),
|
||||
mailing_list_mode: true,
|
||||
add_unsubscribe_link: true,
|
||||
unsubscribe_url: "#{Discourse.base_url}/email/unsubscribe/#{@unsubscribe_key}",
|
||||
}
|
||||
apply_notification_styles(build_email(@user.email, opts))
|
||||
end
|
||||
|
||||
def digest(user, opts={})
|
||||
|
@ -236,7 +241,6 @@ class UserNotifications < ActionMailer::Base
|
|||
end
|
||||
|
||||
def self.get_context_posts(post, topic_user, user)
|
||||
|
||||
if user.user_option.email_previous_replies == UserOption.previous_replies_type[:never]
|
||||
return []
|
||||
end
|
||||
|
@ -376,7 +380,6 @@ class UserNotifications < ActionMailer::Base
|
|||
template << "_staged" if user.staged?
|
||||
end
|
||||
|
||||
|
||||
email_opts = {
|
||||
topic_title: title,
|
||||
message: message,
|
||||
|
|
|
@ -100,6 +100,7 @@ describe UserNotifications do
|
|||
expect(subject.from).to eq([SiteSetting.notification_email])
|
||||
expect(subject.html_part.body.to_s).to include topic.title
|
||||
expect(subject.text_part.body.to_s).to be_present
|
||||
expect(subject.header["List-Unsubscribe"].to_s).to match(/\/email\/unsubscribe\/\h{64}/)
|
||||
end
|
||||
|
||||
it "includes posts less than 24 hours old" do
|
||||
|
|
Loading…
Reference in a new issue