mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 23:33:37 +08:00
FIX: always set a default Message ID in email
This commit is contained in:
parent
3483c8318f
commit
b0369061e2
|
@ -70,6 +70,10 @@ module Email
|
||||||
post_id = header_value('X-Discourse-Post-Id')
|
post_id = header_value('X-Discourse-Post-Id')
|
||||||
reply_key = header_value('X-Discourse-Reply-Key')
|
reply_key = header_value('X-Discourse-Reply-Key')
|
||||||
|
|
||||||
|
# always set a default Message ID from the host
|
||||||
|
uuid = SecureRandom.uuid
|
||||||
|
@message.header['Message-ID'] = "<#{uuid}@#{host}>"
|
||||||
|
|
||||||
if topic_id.present?
|
if topic_id.present?
|
||||||
email_log.topic_id = topic_id
|
email_log.topic_id = topic_id
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,11 @@ describe Email::Sender do
|
||||||
Then { expect(message.header['List-ID']).to be_present }
|
Then { expect(message.header['List-ID']).to be_present }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "adds a Message-ID header even when topic id is not present" do
|
||||||
|
When { email_sender.send }
|
||||||
|
Then { expect(message.header['Message-ID']).to be_present }
|
||||||
|
end
|
||||||
|
|
||||||
context "adds Precedence header" do
|
context "adds Precedence header" do
|
||||||
before do
|
before do
|
||||||
message.header['X-Discourse-Topic-Id'] = 5577
|
message.header['X-Discourse-Topic-Id'] = 5577
|
||||||
|
|
Loading…
Reference in New Issue
Block a user