diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-04-05 07:29:53 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-04-05 07:29:53 +0000 |
commit | 59ac0924da8ffc6ae28eecffda2654cd7ab8f761 (patch) | |
tree | dd2740b77f9af61df459945e60bbd27c0b155140 /app/finders | |
parent | ff648879642f81ccb5eda7c70b9738916a185630 (diff) | |
download | gitlab-ce-59ac0924da8ffc6ae28eecffda2654cd7ab8f761.tar.gz |
Fix IDE detecting MR from fork branch
**Why?**
Currently the IDE loads a merge request based on only the
`source_branch` name. This means it loads MR's from
forks that have the same branch name (not good).
- This required updating the BE API to accept `source_project_id`
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/merge_requests_finder.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 84689ff5dc7..29947bc94d5 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -40,7 +40,8 @@ class MergeRequestsFinder < IssuableFinder items = by_commit(super) items = by_source_branch(items) items = by_wip(items) - by_target_branch(items) + items = by_target_branch(items) + by_source_project_id(items) end private @@ -74,6 +75,16 @@ class MergeRequestsFinder < IssuableFinder items.where(target_branch: target_branch) end + def source_project_id + @source_project_id ||= params[:source_project_id].presence + end + + def by_source_project_id(items) + return items unless source_project_id + + items.where(source_project_id: source_project_id) + end + def by_wip(items) if params[:wip] == 'yes' items.where(wip_match(items.arel_table)) |