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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
9d03e8fd
Commit
9d03e8fd
authored
Apr 07, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Add iid filter to milestones
parent
8cb41f19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
CHANGELOG
CHANGELOG
+1
-0
lib/api/milestones.rb
lib/api/milestones.rb
+2
-0
spec/requests/api/milestones_spec.rb
spec/requests/api/milestones_spec.rb
+5
-3
No files found.
CHANGELOG
View file @
9d03e8fd
...
@@ -23,6 +23,7 @@ v 8.7.0 (unreleased)
...
@@ -23,6 +23,7 @@ v 8.7.0 (unreleased)
- Add default scope to projects to exclude projects pending deletion
- Add default scope to projects to exclude projects pending deletion
- Ensure empty recipients are rejected in BuildsEmailService
- Ensure empty recipients are rejected in BuildsEmailService
- API: Ability to filter milestones by state `active` and `closed` (Robert Schilling)
- API: Ability to filter milestones by state `active` and `closed` (Robert Schilling)
- API: Fix milestone filtering by `iid` (Robert Schilling)
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
- Better errors handling when creating milestones inside groups
- Better errors handling when creating milestones inside groups
- Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.)
- Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.)
...
...
lib/api/milestones.rb
View file @
9d03e8fd
...
@@ -21,6 +21,7 @@ module API
...
@@ -21,6 +21,7 @@ module API
# state (optional) - Return "active" or "closed" milestones
# state (optional) - Return "active" or "closed" milestones
# Example Request:
# Example Request:
# GET /projects/:id/milestones
# GET /projects/:id/milestones
# GET /projects/:id/milestones?iid=42
# GET /projects/:id/milestones?state=active
# GET /projects/:id/milestones?state=active
# GET /projects/:id/milestones?state=closed
# GET /projects/:id/milestones?state=closed
get
":id/milestones"
do
get
":id/milestones"
do
...
@@ -28,6 +29,7 @@ module API
...
@@ -28,6 +29,7 @@ module API
milestones
=
user_project
.
milestones
milestones
=
user_project
.
milestones
milestones
=
filter_milestones_state
(
milestones
,
params
[
:state
])
milestones
=
filter_milestones_state
(
milestones
,
params
[
:state
])
milestones
=
filter_by_iid
(
milestones
,
params
[
:iid
])
if
params
[
:iid
].
present?
present
paginate
(
milestones
),
with:
Entities
::
Milestone
present
paginate
(
milestones
),
with:
Entities
::
Milestone
end
end
...
...
spec/requests/api/milestones_spec.rb
View file @
9d03e8fd
...
@@ -50,10 +50,12 @@ describe API::API, api: true do
...
@@ -50,10 +50,12 @@ describe API::API, api: true do
end
end
it
'should return a project milestone by iid'
do
it
'should return a project milestone by iid'
do
get
api
(
"/projects/
#{
project
.
id
}
/milestones?iid=
#{
milestone
.
iid
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/milestones?iid=
#{
closed_milestone
.
iid
}
"
,
user
)
expect
(
response
.
status
).
to
eq
200
expect
(
response
.
status
).
to
eq
200
expect
(
json_response
.
first
[
'title'
]).
to
eq
milestone
.
title
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
milestone
.
id
expect
(
json_response
.
first
[
'title'
]).
to
eq
closed_milestone
.
title
expect
(
json_response
.
first
[
'id'
]).
to
eq
closed_milestone
.
id
end
end
it
'should return 401 error if user not authenticated'
do
it
'should return 401 error if user not authenticated'
do
...
...
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