diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 13:35:33 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 13:35:33 +0400 |
commit | 17858d49f6b189c922c7a69e94b5d8aa96fb48ad (patch) | |
tree | 7ccc268442c37600f6f484efbca3ae8b9c571cfd /app/mailers | |
parent | 3ea4bf4891d4d9aed994371a3a033db0e7bccbfa (diff) | |
parent | a7bdf87f434a09afd7e96c2e7f99cc3fc5be9a07 (diff) |
Merge pull request #6109 from jamit/master
Added email threading for update emails on issues and merge requests
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/issues.rb | 4 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 4 | ||||
-rw-r--r-- | app/mailers/emails/notes.rb | 2 | ||||
-rw-r--r-- | app/mailers/notify.rb | 16 |
4 files changed, 26 insertions, 0 deletions
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index d684e354452..a096df9dc0d 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -4,6 +4,7 @@ module Emails @issue = Issue.find(issue_id) @project = @issue.project @target_url = project_issue_url(@project, @issue) + set_message_id("issue_#{issue_id}") mail(from: sender(@issue.author_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -14,6 +15,7 @@ module Emails @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @project = @issue.project @target_url = project_issue_url(@project, @issue) + set_reference("issue_#{issue_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -24,6 +26,7 @@ module Emails @project = @issue.project @updated_by = User.find updated_by_user_id @target_url = project_issue_url(@project, @issue) + set_reference("issue_#{issue_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -35,6 +38,7 @@ module Emails @project = @issue.project @updated_by = User.find updated_by_user_id @target_url = project_issue_url(@project, @issue) + set_reference("issue_#{issue_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 1130969a26d..ea5671c4502 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -4,6 +4,7 @@ module Emails @merge_request = MergeRequest.find(merge_request_id) @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_message_id("merge_request_#{merge_request_id}") mail(from: sender(@merge_request.author_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) @@ -14,6 +15,7 @@ module Emails @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_reference("merge_request_#{merge_request_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) @@ -24,6 +26,7 @@ module Emails @updated_by = User.find updated_by_user_id @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_reference("merge_request_#{merge_request_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) @@ -33,6 +36,7 @@ module Emails @merge_request = MergeRequest.find(merge_request_id) @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_reference("merge_request_#{merge_request_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 2a877bc1593..8d1f17b0f81 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -15,6 +15,7 @@ module Emails @issue = @note.noteable @project = @note.project @target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}") + set_reference("issue_#{@issue.id}") mail(from: sender(@note.author_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -25,6 +26,7 @@ module Emails @merge_request = @note.noteable @project = @note.project @target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}") + set_reference("merge_request_#{@merge_request.id}") mail(from: sender(@note.author_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 554f53cf148..84a0da0129d 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -53,6 +53,22 @@ class Notify < ActionMailer::Base end end + # Set the Message-ID header field + # + # local_part - The local part of the message ID + # + def set_message_id(local_part) + headers["Message-ID"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>" + end + + # Set the References header field + # + # local_part - The local part of the referenced message ID + # + def set_reference(local_part) + headers["References"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>" + end + # Formats arguments into a String suitable for use as an email subject # # extra - Extra Strings to be inserted into the subject |