mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 12:24:55 +00:00
FIX: remove custom Discourse headers in email
This commit is contained in:
parent
6856c0a511
commit
e97755ab5d
@ -117,9 +117,9 @@ module Email
|
|||||||
email_log.reply_key = reply_key if reply_key.present?
|
email_log.reply_key = reply_key if reply_key.present?
|
||||||
|
|
||||||
# Remove headers we don't need anymore
|
# Remove headers we don't need anymore
|
||||||
@message.header['X-Discourse-Topic-Id'] = nil
|
@message.header['X-Discourse-Topic-Id'] = nil if topic_id.present?
|
||||||
@message.header['X-Discourse-Post-Id'] = nil
|
@message.header['X-Discourse-Post-Id'] = nil if post_id.present?
|
||||||
@message.header['X-Discourse-Reply-Key'] = nil
|
@message.header['X-Discourse-Reply-Key'] = nil if reply_key.present?
|
||||||
|
|
||||||
# Suppress images from short emails
|
# Suppress images from short emails
|
||||||
if SiteSetting.strip_images_from_short_emails && @message.html_part.body.to_s.bytesize <= SiteSetting.short_email_length && @message.html_part.body =~ /<img[^>]+>/
|
if SiteSetting.strip_images_from_short_emails && @message.html_part.body.to_s.bytesize <= SiteSetting.short_email_length && @message.html_part.body =~ /<img[^>]+>/
|
||||||
|
@ -87,6 +87,24 @@ describe Email::Sender do
|
|||||||
Then { expect(message.header['Precedence']).to be_present }
|
Then { expect(message.header['Precedence']).to be_present }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "removes custom Discourse headers from topic notification mails" do
|
||||||
|
before do
|
||||||
|
message.header['X-Discourse-Topic-Id'] = 5577
|
||||||
|
end
|
||||||
|
|
||||||
|
When { email_sender.send }
|
||||||
|
Then { expect(message.header['X-Discourse-Topic-Id']).not_to be_present }
|
||||||
|
Then { expect(message.header['X-Discourse-Post-Id']).not_to be_present }
|
||||||
|
Then { expect(message.header['X-Discourse-Reply-Key']).not_to be_present }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "removes custom Discourse headers from digest/registration/other mails" do
|
||||||
|
When { email_sender.send }
|
||||||
|
Then { expect(message.header['X-Discourse-Topic-Id']).not_to be_present }
|
||||||
|
Then { expect(message.header['X-Discourse-Post-Id']).not_to be_present }
|
||||||
|
Then { expect(message.header['X-Discourse-Reply-Key']).not_to be_present }
|
||||||
|
end
|
||||||
|
|
||||||
context 'email logs' do
|
context 'email logs' do
|
||||||
let(:email_log) { EmailLog.last }
|
let(:email_log) { EmailLog.last }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user