summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-01-25 17:22:48 +0800
committerPatrick Bajao <ebajao@gitlab.com>2019-01-28 15:11:38 +0800
commit65723a2cb60f46681a766f34102df700ef5b7573 (patch)
tree26007e09b6dacf3232ba6b09b5d7547f34e4b0b6 /app/finders
parent276147c1f6c54ae87941953ec62d0d674c12f462 (diff)
downloadgitlab-ce-65723a2cb60f46681a766f34102df700ef5b7573.tar.gz
Modify MergeRequestsFinder to allow filtering by commit
Diffstat (limited to 'app/finders')
-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 e190d5d90c9..bf01f05a9e9 100644
--- a/app/finders/merge_requests_finder.rb
+++ b/app/finders/merge_requests_finder.rb
@@ -36,13 +36,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