summaryrefslogtreecommitdiff
path: root/app/models/concerns/noteable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/noteable.rb')
-rw-r--r--app/models/concerns/noteable.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb
index 19f2daa1b01..a7f1fb66a88 100644
--- a/app/models/concerns/noteable.rb
+++ b/app/models/concerns/noteable.rb
@@ -79,6 +79,12 @@ module Noteable
.discussions(self)
end
+ def discussion_ids_relation
+ notes.select(:discussion_id)
+ .group(:discussion_id)
+ .order('MIN(created_at), MIN(id)')
+ end
+
def capped_notes_count(max)
notes.limit(max).count
end