diff options
author | Toon Claes <toon@iotcl.com> | 2017-12-09 00:45:57 +0300 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2017-12-13 23:26:01 +0300 |
commit | f55aaca561986757343fb410a9e6c09cfcc61385 (patch) | |
tree | 1c84b54d8cefa3af4768af4cf31740107f188cb2 /app/models/note.rb | |
parent | 2acf3a564c4d042b4cf5463867bd5d37723509f5 (diff) |
Make discussion mail References all notes in the discussion
When a note is part of a discussion, the email sent out will be
`In-Reply-To` the previous note in that discussion. It also
`References` all the previous notes in that discussion, and the
original issue.
Closes gitlab-org/gitlab-ce#36054.
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 9 |
1 files changed, 5 insertions, 4 deletions
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 |