Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4b8fed72
Commit
4b8fed72
authored
Feb 19, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
9b0f8a77
cccf6115
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
changelogs/unreleased/55376-related_merge_requests-api-call-returns-merge-requests-that-are-not-related-to-the-issue.yml
...urns-merge-requests-that-are-not-related-to-the-issue.yml
+5
-0
lib/api/issues.rb
lib/api/issues.rb
+5
-10
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+19
-1
No files found.
changelogs/unreleased/55376-related_merge_requests-api-call-returns-merge-requests-that-are-not-related-to-the-issue.yml
0 → 100644
View file @
4b8fed72
---
title
:
'
API:
Ensure
that
related
merge
requests
are
referenced
cross-project'
merge_request
:
25222
author
:
Robert Schilling
type
:
fixed
lib/api/issues.rb
View file @
4b8fed72
...
...
@@ -306,19 +306,14 @@ module API
get
':id/issues/:issue_iid/related_merge_requests'
do
issue
=
find_project_issue
(
params
[
:issue_iid
])
merge_request
_iid
s
=
::
Issues
::
ReferencedMergeRequestsService
.
new
(
user_project
,
current_user
)
merge_requests
=
::
Issues
::
ReferencedMergeRequestsService
.
new
(
user_project
,
current_user
)
.
execute
(
issue
)
.
flatten
.
map
(
&
:iid
)
merge_requests
=
if
merge_request_iids
.
present?
MergeRequestsFinder
.
new
(
current_user
,
project_id:
user_project
.
id
,
iids:
merge_request_iids
).
execute
else
MergeRequest
.
none
end
present
paginate
(
merge_requests
),
with:
Entities
::
MergeRequestBasic
,
current_user:
current_user
,
project:
user_project
present
paginate
(
::
Kaminari
.
paginate_array
(
merge_requests
)),
with:
Entities
::
MergeRequestBasic
,
current_user:
current_user
,
project:
user_project
end
desc
'List merge requests closing issue'
do
...
...
spec/requests/api/issues_spec.rb
View file @
4b8fed72
...
...
@@ -1898,7 +1898,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
...
...
@@ -1935,6 +1935,24 @@ 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
([
related_mr
.
id
,
merge_request
.
id
])
end
it
'does not generate references to projects with no access'
do
private_project
=
create
(
:project
,
:private
)
create_referencing_mr
(
private_project
.
creator
,
private_project
,
issue
)
get_related_merge_requests
(
project
.
id
,
issue
.
iid
,
user
)
expect_paginated_array_response
(
related_mr
.
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment