Commit 4f34d363 authored by Douwe Maan's avatar Douwe Maan

Correctly set Message-ID for comment notifications.

parent 73eef57d
...@@ -129,11 +129,7 @@ class Notify < ActionMailer::Base ...@@ -129,11 +129,7 @@ class Notify < ActionMailer::Base
"<#{model_name}_#{model.id}@#{Gitlab.config.gitlab.host}>" "<#{model_name}_#{model.id}@#{Gitlab.config.gitlab.host}>"
end end
# Send an email that starts a new conversation thread, def mail_thread(model, headers = {})
# with headers suitable for grouping by thread in email clients.
#
# See: mail_answer_thread
def mail_new_thread(model, headers = {})
if @project if @project
headers['X-GitLab-Project'] = @project.name headers['X-GitLab-Project'] = @project.name
headers['X-GitLab-Project-Id'] = @project.id headers['X-GitLab-Project-Id'] = @project.id
...@@ -142,8 +138,6 @@ class Notify < ActionMailer::Base ...@@ -142,8 +138,6 @@ class Notify < ActionMailer::Base
headers["X-GitLab-#{model.class.name}-ID"] = model.id headers["X-GitLab-#{model.class.name}-ID"] = model.id
headers['Message-ID'] = message_id(model)
if reply_key if reply_key
headers['X-GitLab-Reply-Key'] = reply_key headers['X-GitLab-Reply-Key'] = reply_key
headers['Reply-To'] = Gitlab::ReplyByEmail.reply_address(reply_key) headers['Reply-To'] = Gitlab::ReplyByEmail.reply_address(reply_key)
...@@ -152,6 +146,16 @@ class Notify < ActionMailer::Base ...@@ -152,6 +146,16 @@ class Notify < ActionMailer::Base
mail(headers) mail(headers)
end 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, # Send an email that responds to an existing conversation thread,
# with headers suitable for grouping by thread in email clients. # with headers suitable for grouping by thread in email clients.
# #
...@@ -165,11 +169,9 @@ class Notify < ActionMailer::Base ...@@ -165,11 +169,9 @@ class Notify < ActionMailer::Base
headers['In-Reply-To'] = message_id(model) headers['In-Reply-To'] = message_id(model)
headers['References'] = message_id(model) headers['References'] = message_id(model)
if headers[:subject] headers[:subject].prepend('Re: ') if headers[:subject]
headers[:subject].prepend('Re: ')
end
mail_new_thread(model, headers) mail_thread(model, headers)
end end
def can? def can?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment