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
Léo-Paul Géneau
gitlab-ce
Commits
e6215a9a
Commit
e6215a9a
authored
Apr 06, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve coding and doc style
parent
0728588c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
CHANGELOG
CHANGELOG
+1
-1
doc/api/milestones.md
doc/api/milestones.md
+14
-5
lib/api/milestones.rb
lib/api/milestones.rb
+1
-1
spec/requests/api/milestones_spec.rb
spec/requests/api/milestones_spec.rb
+5
-3
No files found.
CHANGELOG
View file @
e6215a9a
...
...
@@ -15,6 +15,7 @@ v 8.7.0 (unreleased)
- Handle nil descriptions in Slack issue messages (Stan Hu)
- Add default scope to projects to exclude projects pending deletion
- Ensure empty recipients are rejected in BuildsEmailService
- API: Ability to filter milestones by state `active` and `closed` (Robert Schilling)
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
- Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.)
- Gracefully handle notes on deleted commits in merge requests (Stan Hu)
...
...
@@ -25,7 +26,6 @@ v 8.7.0 (unreleased)
- Build status notifications
- API: Ability to retrieve a specific tag (Robert Schilling)
- API: Expose user location (Robert Schilling)
- API: Ability to milter milestones by state `active` and `closed` (Robert Schilling)
v 8.6.5 (unreleased)
- Check permissions when user attempts to import members from another project
...
...
doc/api/milestones.md
View file @
e6215a9a
...
...
@@ -11,6 +11,20 @@ GET /projects/:id/milestones?state=active
GET /projects/:id/milestones?state=closed
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`id`
| integer | yes | The ID of a project |
|
`iid`
| integer | optional | Return only the milestone having the given
`iid`
|
|
`state`
| string | optional | Return only
`active`
or
`closed`
milestones
` |
```bash
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/5/milestones
```
Example Response:
```json
[
{
...
...
@@ -27,11 +41,6 @@ GET /projects/:id/milestones?state=closed
]
```
Parameters:
-
`id`
(required) - The ID of a project
-
`iid`
(optional) - Return the milestone having the given
`iid`
-
`state`
(optional) - Return "active" or "closed" milestones
## Get single milestone
...
...
lib/api/milestones.rb
View file @
e6215a9a
...
...
@@ -27,7 +27,7 @@ module API
authorize!
:read_milestone
,
user_project
milestones
=
user_project
.
milestones
milestones
=
filter_milestones_state
(
milestones
,
params
[
:state
])
unless
params
[
:state
].
nil?
milestones
=
filter_milestones_state
(
milestones
,
params
[
:state
])
present
paginate
(
milestones
),
with:
Entities
::
Milestone
end
...
...
spec/requests/api/milestones_spec.rb
View file @
e6215a9a
...
...
@@ -4,7 +4,7 @@ describe API::API, api: true do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:closed_milestone
)
{
create
(
:closed_milestone
,
project:
project
,
state: :closed
)
}
let!
(
:closed_milestone
)
{
create
(
:closed_milestone
,
project:
project
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
before
{
project
.
team
<<
[
user
,
:developer
]
}
...
...
@@ -22,16 +22,18 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
401
)
end
it
'
should return
an array of active milestones'
do
it
'
returns
an array of active milestones'
do
get
api
(
"/projects/
#{
project
.
id
}
/milestones?state=active"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
milestone
.
id
)
end
it
'
should return
an array of closed milestones'
do
it
'
returns
an array of closed milestones'
do
get
api
(
"/projects/
#{
project
.
id
}
/milestones?state=closed"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
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