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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
006631f8
Commit
006631f8
authored
Oct 25, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply similar change to MRs API
parent
227e30f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
2 deletions
+27
-2
app/finders/issues_finder.rb
app/finders/issues_finder.rb
+1
-0
lib/api/issues.rb
lib/api/issues.rb
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+5
-1
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+3
-0
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+17
-0
No files found.
app/finders/issues_finder.rb
View file @
006631f8
...
@@ -135,6 +135,7 @@ class IssuesFinder < IssuableFinder
...
@@ -135,6 +135,7 @@ class IssuesFinder < IssuableFinder
current_user
.
blank?
current_user
.
blank?
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
by_assignee
(
items
)
def
by_assignee
(
items
)
if
filter_by_no_assignee?
if
filter_by_no_assignee?
items
.
unassigned
items
.
unassigned
...
...
lib/api/issues.rb
View file @
006631f8
...
@@ -42,7 +42,7 @@ module API
...
@@ -42,7 +42,7 @@ module API
optional
:author_id
,
type:
Integer
,
desc:
'Return issues which are authored by the user with the given ID'
optional
:author_id
,
type:
Integer
,
desc:
'Return issues which are authored by the user with the given ID'
optional
:assignee_id
,
types:
[
Integer
,
String
],
optional
:assignee_id
,
types:
[
Integer
,
String
],
values:
->
(
v
)
{
values:
->
(
v
)
{
v
.
is_a?
(
Integer
)
or
[
IssuableFinder
::
FILTER_NONE
,
IssuableFinder
::
FILTER_ANY
].
include?
(
v
)
v
.
is_a?
(
Integer
)
||
[
IssuableFinder
::
FILTER_NONE
,
IssuableFinder
::
FILTER_ANY
].
include?
(
v
)
},
},
desc:
'Return issues which are assigned to the user with the given ID'
desc:
'Return issues which are assigned to the user with the given ID'
optional
:scope
,
type:
String
,
values:
%w[created-by-me assigned-to-me created_by_me assigned_to_me all]
,
optional
:scope
,
type:
String
,
values:
%w[created-by-me assigned-to-me created_by_me assigned_to_me all]
,
...
...
lib/api/merge_requests.rb
View file @
006631f8
...
@@ -89,7 +89,11 @@ module API
...
@@ -89,7 +89,11 @@ module API
optional
:updated_before
,
type:
DateTime
,
desc:
'Return merge requests updated before the specified time'
optional
:updated_before
,
type:
DateTime
,
desc:
'Return merge requests updated before the specified time'
optional
:view
,
type:
String
,
values:
%w[simple]
,
desc:
'If simple, returns the `iid`, URL, title, description, and basic state of merge request'
optional
:view
,
type:
String
,
values:
%w[simple]
,
desc:
'If simple, returns the `iid`, URL, title, description, and basic state of merge request'
optional
:author_id
,
type:
Integer
,
desc:
'Return merge requests which are authored by the user with the given ID'
optional
:author_id
,
type:
Integer
,
desc:
'Return merge requests which are authored by the user with the given ID'
optional
:assignee_id
,
type:
Integer
,
desc:
'Return merge requests which are assigned to the user with the given ID'
optional
:assignee_id
,
types:
[
Integer
,
String
],
values:
->
(
v
)
{
v
.
is_a?
(
Integer
)
||
[
IssuableFinder
::
FILTER_NONE
,
IssuableFinder
::
FILTER_ANY
].
include?
(
v
)
},
desc:
'Return merge requests which are assigned to the user with the given ID'
optional
:scope
,
type:
String
,
values:
%w[created-by-me assigned-to-me created_by_me assigned_to_me all]
,
optional
:scope
,
type:
String
,
values:
%w[created-by-me assigned-to-me created_by_me assigned_to_me all]
,
desc:
'Return merge requests for the given scope: `created_by_me`, `assigned_to_me` or `all`'
desc:
'Return merge requests for the given scope: `created_by_me`, `assigned_to_me` or `all`'
optional
:my_reaction_emoji
,
type:
String
,
desc:
'Return issues reacted by the authenticated user by the given emoji'
optional
:my_reaction_emoji
,
type:
String
,
desc:
'Return issues reacted by the authenticated user by the given emoji'
...
...
spec/requests/api/issues_spec.rb
View file @
006631f8
...
@@ -188,6 +188,9 @@ describe API::Issues do
...
@@ -188,6 +188,9 @@ describe API::Issues do
end
end
it
'returns issues with any assignee'
do
it
'returns issues with any assignee'
do
# This issue without assignee should not be returned
create
(
:issue
,
author:
user2
,
project:
project
)
get
api
(
'/issues'
,
user
),
assignee_id:
'Any'
,
scope:
'all'
get
api
(
'/issues'
,
user
),
assignee_id:
'Any'
,
scope:
'all'
expect_paginated_array_response
(
size:
3
)
expect_paginated_array_response
(
size:
3
)
...
...
spec/requests/api/merge_requests_spec.rb
View file @
006631f8
...
@@ -143,6 +143,23 @@ describe API::MergeRequests do
...
@@ -143,6 +143,23 @@ describe API::MergeRequests do
expect_response_ordered_exactly
(
merge_request3
)
expect_response_ordered_exactly
(
merge_request3
)
end
end
it
'returns an array of merge requests with no assignee'
do
merge_request3
=
create
(
:merge_request
,
:simple
,
author:
user
,
source_project:
project2
,
target_project:
project2
,
source_branch:
'other-branch'
)
get
api
(
'/merge_requests'
,
user
),
assignee_id:
'None'
,
scope: :all
expect_response_ordered_exactly
(
merge_request3
)
end
it
'returns an array of merge requests with any assignee'
do
# This MR with no assignee should not be returned
create
(
:merge_request
,
:simple
,
author:
user
,
source_project:
project2
,
target_project:
project2
,
source_branch:
'other-branch'
)
get
api
(
'/merge_requests'
,
user
),
assignee_id:
'Any'
,
scope: :all
expect_response_contain_exactly
(
merge_request
,
merge_request2
,
merge_request_closed
,
merge_request_merged
,
merge_request_locked
)
end
it
'returns an array of merge requests assigned to me'
do
it
'returns an array of merge requests assigned to me'
do
merge_request3
=
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user2
,
source_project:
project2
,
target_project:
project2
,
source_branch:
'other-branch'
)
merge_request3
=
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user2
,
source_project:
project2
,
target_project:
project2
,
source_branch:
'other-branch'
)
...
...
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