Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e6215a9a
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e6215a9a
编写于
4月 06, 2016
作者:
R
Robert Schilling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve coding and doc style
上级
0728588c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
10 deletion
+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
未找到文件。
CHANGELOG
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录