mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FEATURE: properly set 'In-Reply-To' header when sending an email that is a reply to an incoming email
This commit is contained in:
parent
e09634dbae
commit
2c508f205a
1 changed files with 7 additions and 1 deletions
|
@ -78,10 +78,16 @@ module Email
|
||||||
if topic_id.present?
|
if topic_id.present?
|
||||||
email_log.topic_id = topic_id
|
email_log.topic_id = topic_id
|
||||||
|
|
||||||
|
incoming_email = IncomingEmail.find_by(post_id: post_id, topic_id: topic_id)
|
||||||
|
|
||||||
|
incoming_message_id = nil
|
||||||
|
incoming_message_id = "<#{incoming_email.message_id}>" if incoming_email.try(:message_id).present?
|
||||||
|
|
||||||
topic_identifier = "<topic/#{topic_id}@#{host}>"
|
topic_identifier = "<topic/#{topic_id}@#{host}>"
|
||||||
post_identifier = "<topic/#{topic_id}/#{post_id}@#{host}>"
|
post_identifier = "<topic/#{topic_id}/#{post_id}@#{host}>"
|
||||||
|
|
||||||
@message.header['Message-ID'] = post_identifier
|
@message.header['Message-ID'] = post_identifier
|
||||||
@message.header['In-Reply-To'] = topic_identifier
|
@message.header['In-Reply-To'] = incoming_message_id || topic_identifier
|
||||||
@message.header['References'] = topic_identifier
|
@message.header['References'] = topic_identifier
|
||||||
|
|
||||||
topic = Topic.where(id: topic_id).first
|
topic = Topic.where(id: topic_id).first
|
||||||
|
|
Loading…
Reference in a new issue