diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-04 17:27:23 -0500 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-05 17:44:14 +0100 |
commit | c319f2114177f011cd0c6c23b04f7c19971268bf (patch) | |
tree | b91a2ace5426bea9a7c6a60eabbd44da394fa80c /app/mailers | |
parent | afa53810deab37c95da245510a7cf85e8846a162 (diff) | |
download | gitlab-ce-c319f2114177f011cd0c6c23b04f7c19971268bf.tar.gz |
Address review comments
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/notes.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 3c78e1fcd68..00707a0023e 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -5,11 +5,7 @@ module Emails @commit = @note.noteable @target_url = namespace_project_commit_url(*note_target_url_options) - - mail_answer_thread(@commit, - from: sender(@note.author_id), - to: recipient(recipient_id), - subject: subject("#{@commit.title} (#{@commit.short_id})")) + mail_answer_thread(@commit, note_thread_options(recipient_id)) end def note_issue_email(recipient_id, note_id) @@ -54,16 +50,18 @@ module Emails { from: sender(@note.author_id), to: recipient(recipient_id), - subject: subject("#{@note.noteable.title} (#{@note.noteable.to_reference})") + subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})") } end def setup_note_mail(note_id, recipient_id) - @note = Note.find(note_id) + # `note_id` is a `Note` when originating in `NotifyPreview` + @note = note_id.is_a?(Note) ? note_id : Note.find(note_id) @project = @note.project - return unless @project - @sent_notification = SentNotification.record_note(@note, recipient_id, reply_key) + if @project && @note.persisted? + @sent_notification = SentNotification.record_note(@note, recipient_id, reply_key) + end end end end |