diff options
author | Rémy Coutable <remy@rymai.me> | 2016-03-17 20:03:51 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-25 13:05:15 +0100 |
commit | 9f218fc184894d61c10f738c59bce97780f06e25 (patch) | |
tree | edc94e1c3ac7bae80edb14f86810a12e98e13f5e /lib/gitlab/email/receiver.rb | |
parent | 31e76baf610e1307090a6bac3a7b3d525bce057a (diff) | |
download | gitlab-ce-2364-fallback-to-in-reply-to-header.tar.gz |
Improve and finish the fallback to the In-Reply-To and References header for the reply-by-email feature2364-fallback-to-in-reply-to-header
A few things to note:
- The IncomingEmail feature is now enabled even without a
correctly-formatted sub-address
- Message-ID for new thread mail are kept the same so that subsequent
notifications to this thread are grouped in the thread by the email
service that receives the notification
(i.e. In-Reply-To of the answer == Message-ID of the first thread message)
- To maximize our chance to be able to retrieve the reply key, we look
for it in the In-Reply-To header and the References header
- The pattern for the fallback reply message id is "reply-[key]@[gitlab_host]"
- Improve docs thanks to Axil
Diffstat (limited to 'lib/gitlab/email/receiver.rb')
-rw-r--r-- | lib/gitlab/email/receiver.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/gitlab/email/receiver.rb b/lib/gitlab/email/receiver.rb index d55bacde5b0..97ef9851d71 100644 --- a/lib/gitlab/email/receiver.rb +++ b/lib/gitlab/email/receiver.rb @@ -63,10 +63,10 @@ module Gitlab end def reply_key - key_from_to_address || key_from_in_reply_to_header + key_from_to_header || key_from_additional_headers end - def key_from_to_address + def key_from_to_header key = nil message.to.each do |address| key = Gitlab::IncomingEmail.key_from_address(address) @@ -76,11 +76,11 @@ module Gitlab key end - def key_from_in_reply_to_header + def key_from_additional_headers reply_key = nil - message[:in_reply_to].message_ids.each do |message_id| - reply_key = Gitlab::IncomingEmail.key_from_address(message_id) + Array(message.references).each do |message_id| + reply_key = Gitlab::IncomingEmail.key_from_fallback_reply_message_id(message_id) break if reply_key end |