Put fallback reply-key address first in the References header
The References header is an ordered list of mails, and some clients only look at the last mail in the list to determine to which mail the mail is in reply to. Therefore, to be a less obtrusive as possible, put the fallback address first. Some info about the reply key lookup in the References header: https://docs.gitlab.com/ee/administration/reply_by_email.html#how-it-works
This commit is contained in:
parent
2fbafe1a41
commit
b1f236164e
9 changed files with 14 additions and 9 deletions
|
@ -124,7 +124,7 @@ class Notify < BaseMailer
|
|||
|
||||
fallback_reply_message_id = "<reply-#{reply_key}@#{Gitlab.config.gitlab.host}>".freeze
|
||||
headers['References'] ||= []
|
||||
headers['References'] << fallback_reply_message_id
|
||||
headers['References'].unshift(fallback_reply_message_id)
|
||||
|
||||
@reply_by_email = true
|
||||
end
|
||||
|
@ -158,7 +158,7 @@ class Notify < BaseMailer
|
|||
def mail_answer_thread(model, headers = {})
|
||||
headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
|
||||
headers['In-Reply-To'] = message_id(model)
|
||||
headers['References'] = message_id(model)
|
||||
headers['References'] = [message_id(model)]
|
||||
|
||||
headers[:subject]&.prepend('Re: ')
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Put fallback reply-key address first in the References header
|
||||
merge_request: 20871
|
||||
author:
|
||||
type: changed
|
2
spec/fixtures/emails/commands_in_reply.eml
vendored
2
spec/fixtures/emails/commands_in_reply.eml
vendored
|
@ -8,7 +8,7 @@ From: Jake the Dog <jake@adventuretime.ooo>
|
|||
To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo
|
||||
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||
In-Reply-To: <issue_1@localhost>
|
||||
References: <issue_1@localhost> <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost>
|
||||
References: <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost> <issue_1@localhost>
|
||||
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain;
|
||||
|
|
2
spec/fixtures/emails/commands_only_reply.eml
vendored
2
spec/fixtures/emails/commands_only_reply.eml
vendored
|
@ -8,7 +8,7 @@ From: Jake the Dog <jake@adventuretime.ooo>
|
|||
To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo
|
||||
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||
In-Reply-To: <issue_1@localhost>
|
||||
References: <issue_1@localhost> <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost>
|
||||
References: <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost> <issue_1@localhost>
|
||||
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain;
|
||||
|
|
|
@ -8,7 +8,7 @@ From: Jake the Dog <jake@adventuretime.ooo>
|
|||
To: reply@appmail.adventuretime.ooo
|
||||
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||
In-Reply-To: <issue_1@localhost>
|
||||
References: <issue_1@localhost> <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost>
|
||||
References: <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost> <issue_1@localhost>
|
||||
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain;
|
||||
|
|
|
@ -8,7 +8,7 @@ From: Jake the Dog <jake@adventuretime.ooo>
|
|||
To: reply@appmail.adventuretime.ooo
|
||||
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||
In-Reply-To: <issue_1@localhost>
|
||||
References: <issue_1@localhost> <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost>,<exchange@microsoft.com>
|
||||
References: <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost> <issue_1@localhost>,<exchange@microsoft.com>
|
||||
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain;
|
||||
|
|
|
@ -8,7 +8,7 @@ From: Jake the Dog <jake@adventuretime.ooo>
|
|||
To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo
|
||||
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||
In-Reply-To: <issue_1@localhost>
|
||||
References: <issue_1@localhost> <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost>
|
||||
References: <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost> <issue_1@localhost>
|
||||
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain;
|
||||
|
|
2
spec/fixtures/emails/valid_reply.eml
vendored
2
spec/fixtures/emails/valid_reply.eml
vendored
|
@ -8,7 +8,7 @@ From: Jake the Dog <jake@adventuretime.ooo>
|
|||
To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo
|
||||
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||
In-Reply-To: <issue_1@localhost>
|
||||
References: <issue_1@localhost> <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost>
|
||||
References: <reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost> <issue_1@localhost>
|
||||
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain;
|
||||
|
|
|
@ -77,7 +77,7 @@ shared_examples 'a thread answer email with reply-by-email enabled' do
|
|||
aggregate_failures do
|
||||
is_expected.to have_header('Message-ID', /\A<.*@#{host}>\Z/)
|
||||
is_expected.to have_header('In-Reply-To', "<#{route_key}@#{host}>")
|
||||
is_expected.to have_header('References', /\A<#{route_key}@#{host}> <reply\-.*@#{host}>\Z/ )
|
||||
is_expected.to have_header('References', /\A<reply\-.*@#{host}> <#{route_key}@#{host}>\Z/ )
|
||||
is_expected.to have_subject(/^Re: /)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue