diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/mailers/notify.rb | 8 | ||||
-rw-r--r-- | app/models/note.rb | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 250583d2d28..ec886e993c3 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -119,8 +119,8 @@ class Notify < BaseMailer headers['Reply-To'] = address fallback_reply_message_id = "<reply-#{reply_key}@#{Gitlab.config.gitlab.host}>".freeze - headers['References'] ||= '' - headers['References'] << ' ' << fallback_reply_message_id + headers['References'] ||= [] + headers['References'] << fallback_reply_message_id @reply_by_email = true end @@ -158,8 +158,8 @@ class Notify < BaseMailer 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['In-Reply-To'] = message_id(note.references.last) + headers['References'] = note.references.map { |ref| message_id(ref) } headers['X-GitLab-Discussion-ID'] = note.discussion.id if note.part_of_discussion? diff --git a/app/models/note.rb b/app/models/note.rb index ea31bc45c61..184fbd5f5ae 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -360,13 +360,14 @@ class Note < ActiveRecord::Base end end - def replies_to + def references + refs = [noteable] + if part_of_discussion? - previous_note = discussion.notes.take_while { |n| n.id < id }.last - return previous_note if previous_note + refs += discussion.notes.take_while { |n| n.id < id } end - noteable + refs end def expire_etag_cache |