summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-21 15:38:14 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-24 12:30:37 +0200
commit4f2e4c76561ba5b921b16d0ba4245f594c399e06 (patch)
treec89634e65539309e049178bd4b5d31a1482f3962
parente739eb036df23db4a03681190bf07ba0b8f1302c (diff)
downloadgitlab-ce-4f2e4c76561ba5b921b16d0ba4245f594c399e06.tar.gz
Select MR commit notes from source project.
-rw-r--r--app/models/merge_request.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index e242cae8ea1..49a00697ee1 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -213,10 +213,13 @@ class MergeRequest < ActiveRecord::Base
commits_for_notes_limit = 100
commit_ids = commits.last(commits_for_notes_limit).map(&:id)
- project.notes.where(
- "(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))",
+ Note.where(
+ "(project_id = :target_project_id AND noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR" +
+ "(project_id = :source_project_id AND noteable_type = 'Commit' AND commit_id IN (:commit_ids))",
mr_id: id,
- commit_ids: commit_ids
+ commit_ids: commit_ids,
+ target_project_id: target_project_id,
+ source_project_id: source_project_id
)
end