summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-10 00:06:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-10 00:06:44 +0000
commit308146dc398fd4c13453048105498018459e0985 (patch)
treed843eb63c1672e4b18c483907e2cd4aa7fca708e /app/models/note.rb
parent4b28d5ae770c6bd332283a3f13ceae06329c409b (diff)
downloadgitlab-ce-308146dc398fd4c13453048105498018459e0985.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 03a38346731..edc4a332581 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -193,6 +193,12 @@ class Note < ApplicationRecord
groups
end
+ def positions
+ where.not(position: nil)
+ .select(:id, :type, :position) # ActiveRecord needs id and type for typecasting.
+ .map(&:position)
+ end
+
def count_for_collection(ids, type)
user.select('noteable_id', 'COUNT(*) as count')
.group(:noteable_id)