summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-05 00:25:40 +0200
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-10 01:31:36 +0200
commit6dc8c0eac28d826a4a58bcb3cdac070f3de2a10c (patch)
treed65d7d0e9978f4571d54f0454b9ca1fe822176c8 /app/models
parent77bde9a0e41e9229357983d258eaea9d7ef67017 (diff)
downloadgitlab-ce-6dc8c0eac28d826a4a58bcb3cdac070f3de2a10c.tar.gz
Make MRs also count and display its commits' notes
Diffstat (limited to 'app/models')
-rw-r--r--app/models/merge_request.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index b6392ce8f5d..5b3c37249fc 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -186,6 +186,11 @@ class MergeRequest < ActiveRecord::Base
patch_path
end
+
+ def mr_and_commit_notes
+ commit_ids = commits.map(&:id)
+ Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids)
+ end
end
# == Schema Information