summaryrefslogtreecommitdiff
path: root/app/finders/merge_requests_finder.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2019-03-04 18:37:10 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2019-03-04 18:37:10 +0000
commit6683298fe6d85bb0785906723663482798418907 (patch)
treefafecb6b03174e521879d21f81d8bf39120c51c5 /app/finders/merge_requests_finder.rb
parenta43fd6acb697edc897e930dee7c636e4d714565e (diff)
parent325527e6ca7635aeeea8e0beb7523c3892e21bf6 (diff)
downloadgitlab-ce-6683298fe6d85bb0785906723663482798418907.tar.gz
Merge branch 'security-commit-private-related-mr' into 'master'
Don't allow non-members to see private related MRs Closes #2787 See merge request gitlab/gitlabhq!2866
Diffstat (limited to 'app/finders/merge_requests_finder.rb')
-rw-r--r--app/finders/merge_requests_finder.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb
index b645011a3c5..93bee3f1488 100644
--- a/app/finders/merge_requests_finder.rb
+++ b/app/finders/merge_requests_finder.rb
@@ -37,13 +37,20 @@ class MergeRequestsFinder < IssuableFinder
end
def filter_items(_items)
- items = by_source_branch(super)
+ items = by_commit(super)
+ items = by_source_branch(items)
items = by_wip(items)
by_target_branch(items)
end
private
+ def by_commit(items)
+ return items unless params[:commit_sha].presence
+
+ items.by_commit_sha(params[:commit_sha])
+ end
+
def source_branch
@source_branch ||= params[:source_branch].presence
end