summaryrefslogtreecommitdiff
path: root/app/mailers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-08-29 20:20:03 +0100
committerMayra Cabrera <mcabrera@gitlab.com>2019-09-02 12:15:24 -0500
commit075f6d3559f0a0127fb322b40fad7985df621fcd (patch)
treec45e8aee6c8954f7b7d8e81d2c0b1d9aee0d3be0 /app/mailers
parentd3076322f230cea1f60a7e27d7ae6e1fb770234a (diff)
downloadgitlab-ce-075f6d3559f0a0127fb322b40fad7985df621fcd.tar.gz
Add X-GitLab-NotificationReason header to note emailsadd-notification-reason-to-note-emails
The 'assigned' reason doesn't apply to notes, but the other two can ('mentioned' and 'own_activity'), so we can still use this for note emails.
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/emails/notes.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb
index 04db1980b99..8b93ead0ee6 100644
--- a/app/mailers/emails/notes.rb
+++ b/app/mailers/emails/notes.rb
@@ -2,44 +2,44 @@
module Emails
module Notes
- def note_commit_email(recipient_id, note_id)
+ def note_commit_email(recipient_id, note_id, reason = nil)
setup_note_mail(note_id, recipient_id)
@commit = @note.noteable
@target_url = project_commit_url(*note_target_url_options)
- mail_answer_note_thread(@commit, @note, note_thread_options(recipient_id))
+ mail_answer_note_thread(@commit, @note, note_thread_options(recipient_id, reason))
end
- def note_issue_email(recipient_id, note_id)
+ def note_issue_email(recipient_id, note_id, reason = nil)
setup_note_mail(note_id, recipient_id)
@issue = @note.noteable
@target_url = project_issue_url(*note_target_url_options)
- mail_answer_note_thread(@issue, @note, note_thread_options(recipient_id))
+ mail_answer_note_thread(@issue, @note, note_thread_options(recipient_id, reason))
end
- def note_merge_request_email(recipient_id, note_id)
+ def note_merge_request_email(recipient_id, note_id, reason = nil)
setup_note_mail(note_id, recipient_id)
@merge_request = @note.noteable
@target_url = project_merge_request_url(*note_target_url_options)
- mail_answer_note_thread(@merge_request, @note, note_thread_options(recipient_id))
+ mail_answer_note_thread(@merge_request, @note, note_thread_options(recipient_id, reason))
end
- def note_project_snippet_email(recipient_id, note_id)
+ def note_project_snippet_email(recipient_id, note_id, reason = nil)
setup_note_mail(note_id, recipient_id)
@snippet = @note.noteable
@target_url = project_snippet_url(*note_target_url_options)
- mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id))
+ mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id, reason))
end
- def note_personal_snippet_email(recipient_id, note_id)
+ def note_personal_snippet_email(recipient_id, note_id, reason = nil)
setup_note_mail(note_id, recipient_id)
@snippet = @note.noteable
@target_url = snippet_url(@note.noteable)
- mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id))
+ mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id, reason))
end
private
@@ -48,11 +48,12 @@ module Emails
[@project || @group, @note.noteable, anchor: "note_#{@note.id}"]
end
- def note_thread_options(recipient_id)
+ def note_thread_options(recipient_id, reason)
{
from: sender(@note.author_id),
to: recipient(recipient_id, @project&.group || @group),
- subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})")
+ subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})"),
+ 'X-GitLab-NotificationReason' => reason
}
end