Commit 3dd940ae authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents e54d7ee3 d793d4a7
---
title: Remove duplicates from issue related merge requests
merge_request: 27067
author:
type: fixed
......@@ -307,7 +307,7 @@ module API
merge_requests = ::Issues::ReferencedMergeRequestsService.new(user_project, current_user)
.execute(issue)
.flatten
.first
present paginate(::Kaminari.paginate_array(merge_requests)),
with: Entities::MergeRequest,
......
......@@ -2193,6 +2193,18 @@ describe API::Issues do
expect_paginated_array_response(related_mr.id)
end
context 'merge request closes an issue' do
let!(:closing_issue_mr_rel) do
create(:merge_requests_closing_issues, issue: issue, merge_request: related_mr)
end
it 'returns closing MR only once' do
get_related_merge_requests(project.id, issue.iid, user)
expect_paginated_array_response([related_mr.id])
end
end
context 'no merge request mentioned a issue' do
it 'returns empty array' do
get_related_merge_requests(project.id, closed_issue.iid, user)
......
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