diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-10-07 14:49:01 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-10-07 14:49:01 +0300 |
commit | b658489f27454a130b813cad95b0bd3f9bdac1c8 (patch) | |
tree | b9d1f2eb7f28d5cc3ad3a07521318eaf34ff74ab | |
parent | dc825ae33016b91235e210c2d37323c076fcf572 (diff) | |
download | gitlab-ce-b658489f27454a130b813cad95b0bd3f9bdac1c8.tar.gz |
Fix bugs when discussion visible in wrong project
Because notes scope was not limited by project in
MergeRequest#mr_and_commit_notes it causes comments from project A
appears in discussions for MR in project B.
-rw-r--r-- | app/models/merge_request.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index a26190015b2..b164ea11073 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -222,7 +222,11 @@ class MergeRequest < ActiveRecord::Base 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 commit_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids) + project.notes.where( + "(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))", + mr_id: id, + commit_ids: commit_ids + ) end # Returns the raw diff for this merge request |