diff options
Diffstat (limited to 'app/mailers/emails/notes.rb')
-rw-r--r-- | app/mailers/emails/notes.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 587c1479286..1e254a32885 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -7,7 +7,7 @@ module Emails @commit = @note.noteable @target_url = project_commit_url(*note_target_url_options) - mail_answer_note_thread(@commit, @note, note_thread_options(recipient_id, reason)) + mail_answer_note_thread(@commit, @note, note_thread_options(reason)) end def note_issue_email(recipient_id, note_id, reason = nil) @@ -15,7 +15,7 @@ module Emails @issue = @note.noteable @target_url = project_issue_url(*note_target_url_options) - mail_answer_note_thread(@issue, @note, note_thread_options(recipient_id, reason)) + mail_answer_note_thread(@issue, @note, note_thread_options(reason)) end def note_merge_request_email(recipient_id, note_id, reason = nil) @@ -23,7 +23,7 @@ module Emails @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, reason)) + mail_answer_note_thread(@merge_request, @note, note_thread_options(reason)) end def note_snippet_email(recipient_id, note_id, reason = nil) @@ -37,7 +37,7 @@ module Emails @target_url = gitlab_snippet_url(@note.noteable) end - mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id, reason)) + mail_answer_note_thread(@snippet, @note, note_thread_options(reason)) end def note_design_email(recipient_id, note_id, reason = nil) @@ -49,7 +49,7 @@ module Emails design.issue, note_target_url_query_params.merge(vueroute: design.filename) ) - mail_answer_note_thread(design, @note, note_thread_options(recipient_id, reason)) + mail_answer_note_thread(design, @note, note_thread_options(reason)) end private @@ -62,10 +62,10 @@ module Emails { anchor: "note_#{@note.id}" } end - def note_thread_options(recipient_id, reason) + def note_thread_options(reason) { from: sender(@note.author_id), - to: User.find(recipient_id).notification_email_for(@project&.group || @group), + to: @recipient.notification_email_for(@project&.group || @group), subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})"), 'X-GitLab-NotificationReason' => reason } @@ -76,6 +76,7 @@ module Emails @note = note_id.is_a?(Note) ? note_id : Note.find(note_id) @project = @note.project @group = @note.noteable.try(:group) + @recipient = User.find(recipient_id) if (@project || @group) && @note.persisted? @sent_notification = SentNotification.record_note(@note, recipient_id, reply_key) |