Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-21 01:18:18 +0300
committerDouwe Maan <douwe@selenight.nl>2016-07-21 01:18:18 +0300
commit79214be727aaa0704a1be5b50aa6dd3011629bc2 (patch)
tree8be3ad3775acebb43b114cd90a8fc919097a7b2c /app/models/note.rb
parent5a77eb153669bfbac4ab1f05615d11965beb826d (diff)
Add Discussion model to represent MR/diff discussion
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 0ce10c77de9..9b0a7211b4e 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -82,11 +82,12 @@ class Note < ActiveRecord::Base
end
def discussions
- all.group_by(&:discussion_id).values
+ Discussion.for_notes(all)
end
- def grouped_diff_notes
- diff_notes.select(&:active?).sort_by(&:created_at).group_by(&:line_code)
+ def grouped_diff_discussions
+ notes = diff_notes.fresh.select(&:active?)
+ Discussion.for_diff_notes(notes).map { |d| [d.line_code, d] }.to_h
end
# Searches for notes matching the given query.