Commit feb2cb90 authored by Robert Schilling's avatar Robert Schilling

API: Reference MRs cross-project wise

parent 7a8f8714
......@@ -311,7 +311,7 @@ module API
merge_requests =
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
MergeRequest.none
end
......
......@@ -1792,7 +1792,7 @@ describe API::Issues do
description: "See #{issue.to_reference}"
}
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
......@@ -1829,6 +1829,15 @@ describe API::Issues do
expect_paginated_array_response(related_mr.id)
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
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