summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb9
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?