diff options
author | Sean McGivern <sean@gitlab.com> | 2019-02-19 15:05:26 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-02-19 15:05:26 +0300 |
commit | cccf61150900778899d5e8763a0209fe22d87532 (patch) | |
tree | 4514161f19768c0f7f6a45fcba65ad8c7241e89c /lib | |
parent | 08e2104e0445877a056468d4675aa72af5ebb2ae (diff) | |
parent | 3dca5b307683e9f91941d6ddafaace6d856f8c7b (diff) |
Merge branch '55376-related_merge_requests-api-call-returns-merge-requests-that-are-not-related-to-the-issue' into 'master'
Ensure that related_merge_requests api call returns merge requests in the correct scope
Closes #55376
See merge request gitlab-org/gitlab-ce!25222
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/issues.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index aa8010eb12d..94ed9ac6fb1 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -303,19 +303,14 @@ module API get ':id/issues/:issue_iid/related_merge_requests' do issue = find_project_issue(params[:issue_iid]) - merge_request_iids = ::Issues::ReferencedMergeRequestsService.new(user_project, current_user) + merge_requests = ::Issues::ReferencedMergeRequestsService.new(user_project, current_user) .execute(issue) .flatten - .map(&:iid) - merge_requests = - if merge_request_iids.present? - MergeRequestsFinder.new(current_user, project_id: user_project.id, iids: merge_request_iids).execute - else - MergeRequest.none - end - - present paginate(merge_requests), with: Entities::MergeRequestBasic, current_user: current_user, project: user_project + present paginate(::Kaminari.paginate_array(merge_requests)), + with: Entities::MergeRequestBasic, + current_user: current_user, + project: user_project end desc 'List merge requests closing issue' do |