Directly use MRs given by ReferencedMergeRequestsService
This commit is contained in:
parent
feb2cb9085
commit
6e4fdc117c
|
@ -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
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue