diff options
author | Toon Claes <toon@iotcl.com> | 2017-09-15 08:58:21 +0200 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2017-12-13 21:26:01 +0100 |
commit | 2acf3a564c4d042b4cf5463867bd5d37723509f5 (patch) | |
tree | 76be3f9413422d7444f58b3750e10e0677d94ec7 /app/models/note.rb | |
parent | 43b98944fb34d1a3ca37ae598327e4575d2ec315 (diff) | |
download | gitlab-ce-2acf3a564c4d042b4cf5463867bd5d37723509f5.tar.gz |
Make mail notifications of discussion notes In-Reply-To of each other
When a note is part of a discussion, the email sent out should be
`In-Reply-To` the previous note in that discussion.
Closes gitlab-org/gitlab-ce#36054
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index 02f9fd61e49..ea31bc45c61 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -360,6 +360,15 @@ class Note < ActiveRecord::Base end end + def replies_to + if part_of_discussion? + previous_note = discussion.notes.take_while { |n| n.id < id }.last + return previous_note if previous_note + end + + noteable + end + def expire_etag_cache return unless noteable&.discussions_rendered_on_frontend? |