Correctly set Message-ID for comment notifications.

This commit is contained in:
Douwe Maan 2015-08-19 10:17:20 -07:00
parent 73eef57d5e
commit 4f34d363a5
1 changed files with 13 additions and 11 deletions

View File

@ -129,11 +129,7 @@ class Notify < ActionMailer::Base
"<#{model_name}_#{model.id}@#{Gitlab.config.gitlab.host}>"
end
# Send an email that starts a new conversation thread,
# with headers suitable for grouping by thread in email clients.
#
# See: mail_answer_thread
def mail_new_thread(model, headers = {})
def mail_thread(model, headers = {})
if @project
headers['X-GitLab-Project'] = @project.name
headers['X-GitLab-Project-Id'] = @project.id
@ -142,8 +138,6 @@ class Notify < ActionMailer::Base
headers["X-GitLab-#{model.class.name}-ID"] = model.id
headers['Message-ID'] = message_id(model)
if reply_key
headers['X-GitLab-Reply-Key'] = reply_key
headers['Reply-To'] = Gitlab::ReplyByEmail.reply_address(reply_key)
@ -152,6 +146,16 @@ class Notify < ActionMailer::Base
mail(headers)
end
# Send an email that starts a new conversation thread,
# with headers suitable for grouping by thread in email clients.
#
# See: mail_answer_thread
def mail_new_thread(model, headers = {})
headers['Message-ID'] = message_id(model)
mail_thread(model, headers)
end
# Send an email that responds to an existing conversation thread,
# with headers suitable for grouping by thread in email clients.
#
@ -165,11 +169,9 @@ class Notify < ActionMailer::Base
headers['In-Reply-To'] = message_id(model)
headers['References'] = message_id(model)
if headers[:subject]
headers[:subject].prepend('Re: ')
end
headers[:subject].prepend('Re: ') if headers[:subject]
mail_new_thread(model, headers)
mail_thread(model, headers)
end
def can?