summaryrefslogtreecommitdiff
path: root/app/mailers
diff options
context:
space:
mode:
authorToon Claes <toon@iotcl.com>2017-09-15 08:58:21 +0200
committerToon Claes <toon@iotcl.com>2017-12-13 21:26:01 +0100
commit2acf3a564c4d042b4cf5463867bd5d37723509f5 (patch)
tree76be3f9413422d7444f58b3750e10e0677d94ec7 /app/mailers
parent43b98944fb34d1a3ca37ae598327e4575d2ec315 (diff)
downloadgitlab-ce-2acf3a564c4d042b4cf5463867bd5d37723509f5.tar.gz
Make mail notifications of discussion notes In-Reply-To of each other
When a note is part of a discussion, the email sent out should be `In-Reply-To` the previous note in that discussion. Closes gitlab-org/gitlab-ce#36054
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/emails/notes.rb10
-rw-r--r--app/mailers/notify.rb12
2 files changed, 17 insertions, 5 deletions
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb
index 77a82b895ce..50e17fe7717 100644
--- a/app/mailers/emails/notes.rb
+++ b/app/mailers/emails/notes.rb
@@ -5,7 +5,7 @@ module Emails
@commit = @note.noteable
@target_url = project_commit_url(*note_target_url_options)
- mail_answer_thread(@commit, note_thread_options(recipient_id))
+ mail_answer_note_thread(@commit, @note, note_thread_options(recipient_id))
end
def note_issue_email(recipient_id, note_id)
@@ -13,7 +13,7 @@ module Emails
@issue = @note.noteable
@target_url = project_issue_url(*note_target_url_options)
- mail_answer_thread(@issue, note_thread_options(recipient_id))
+ mail_answer_note_thread(@issue, @note, note_thread_options(recipient_id))
end
def note_merge_request_email(recipient_id, note_id)
@@ -21,7 +21,7 @@ module Emails
@merge_request = @note.noteable
@target_url = project_merge_request_url(*note_target_url_options)
- mail_answer_thread(@merge_request, note_thread_options(recipient_id))
+ mail_answer_note_thread(@merge_request, @note, note_thread_options(recipient_id))
end
def note_snippet_email(recipient_id, note_id)
@@ -29,7 +29,7 @@ module Emails
@snippet = @note.noteable
@target_url = project_snippet_url(*note_target_url_options)
- mail_answer_thread(@snippet, note_thread_options(recipient_id))
+ mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id))
end
def note_personal_snippet_email(recipient_id, note_id)
@@ -37,7 +37,7 @@ module Emails
@snippet = @note.noteable
@target_url = snippet_url(@note.noteable)
- mail_answer_thread(@snippet, note_thread_options(recipient_id))
+ mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id))
end
private
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 9efabe3f44e..250583d2d28 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -156,6 +156,18 @@ class Notify < BaseMailer
mail_thread(model, headers)
end
+ def mail_answer_note_thread(model, note, headers = {})
+ headers['Message-ID'] = message_id(note)
+ headers['In-Reply-To'] = message_id(note.replies_to)
+ headers['References'] = message_id(model)
+
+ headers['X-GitLab-Discussion-ID'] = note.discussion.id if note.part_of_discussion?
+
+ headers[:subject]&.prepend('Re: ')
+
+ mail_thread(model, headers)
+ end
+
def reply_key
@reply_key ||= SentNotification.reply_key
end