Commit 6e4fdc11 authored by Robert Schilling's avatar Robert Schilling

Directly use MRs given by ReferencedMergeRequestsService

parent feb2cb90
...@@ -304,19 +304,14 @@ module API ...@@ -304,19 +304,14 @@ module API
get ':id/issues/:issue_iid/related_merge_requests' do get ':id/issues/:issue_iid/related_merge_requests' do
issue = find_project_issue(params[:issue_iid]) 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) .execute(issue)
.flatten .flatten
.map(&:iid)
merge_requests = present paginate(::Kaminari.paginate_array(merge_requests)),
if merge_request_iids.present? with: Entities::MergeRequestBasic,
MergeRequest.all.where(iid: merge_request_iids) current_user: current_user,
else project: user_project
MergeRequest.none
end
present paginate(merge_requests), with: Entities::MergeRequestBasic, current_user: current_user, project: user_project
end end
desc 'List merge requests closing issue' do desc 'List merge requests closing issue' do
......
...@@ -1835,7 +1835,7 @@ describe API::Issues do ...@@ -1835,7 +1835,7 @@ describe API::Issues do
get_related_merge_requests(project.id, issue.iid, user) get_related_merge_requests(project.id, issue.iid, user)
expect_paginated_array_response(merge_request.id) expect_paginated_array_response([related_mr.id, merge_request.id])
end end
context 'no merge request mentioned a issue' do context 'no merge request mentioned a issue' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment