Commit feb2cb90 authored by Robert Schilling's avatar Robert Schilling

API: Reference MRs cross-project wise

parent 7a8f8714
...@@ -311,7 +311,7 @@ module API ...@@ -311,7 +311,7 @@ module API
merge_requests = merge_requests =
if merge_request_iids.present? if merge_request_iids.present?
MergeRequestsFinder.new(current_user, project_id: user_project.id, iids: merge_request_iids).execute MergeRequest.all.where(iid: merge_request_iids)
else else
MergeRequest.none MergeRequest.none
end end
......
...@@ -1792,7 +1792,7 @@ describe API::Issues do ...@@ -1792,7 +1792,7 @@ describe API::Issues do
description: "See #{issue.to_reference}" description: "See #{issue.to_reference}"
} }
create(:merge_request, attributes).tap do |merge_request| create(:merge_request, attributes).tap do |merge_request|
create(:note, :system, project: project, noteable: issue, author: user, note: merge_request.to_reference(full: true)) create(:note, :system, project: issue.project, noteable: issue, author: user, note: merge_request.to_reference(full: true))
end end
end end
...@@ -1829,6 +1829,15 @@ describe API::Issues do ...@@ -1829,6 +1829,15 @@ describe API::Issues do
expect_paginated_array_response(related_mr.id) expect_paginated_array_response(related_mr.id)
end end
it 'returns merge requests cross-project wide' do
project2 = create(:project, :public, creator_id: user.id, namespace: user.namespace)
merge_request = create_referencing_mr(user, project2, issue)
get_related_merge_requests(project.id, issue.iid, user)
expect_paginated_array_response(merge_request.id)
end
context 'no merge request mentioned a issue' do context 'no merge request mentioned a issue' do
it 'returns empty array' do it 'returns empty array' do
get_related_merge_requests(project.id, closed_issue.iid, user) 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