Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c1467f5d
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 搜索 >>
提交
c1467f5d
编写于
4月 05, 2016
作者:
M
Michael Greene
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow back dating notes on creation
上级
28a7fe25
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
0 deletion
+20
-0
CHANGELOG
CHANGELOG
+1
-0
doc/api/notes.md
doc/api/notes.md
+1
-0
lib/api/notes.rb
lib/api/notes.rb
+5
-0
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+13
-0
未找到文件。
CHANGELOG
浏览文件 @
c1467f5d
...
...
@@ -23,6 +23,7 @@ v 8.7.0 (unreleased)
- Fix Error 500 after renaming a project path (Stan Hu)
- Fix a bug whith trailing slash in teamcity_url (Charles May)
- Allow back dating on issues when created or updated through the API
- Allow back dating on issue notes when created through the API
- Fix avatar stretching by providing a cropping feature
- API: Expose `subscribed` for issues and merge requests (Robert Schilling)
- Allow SAML to handle external users based on user's information !3530
...
...
doc/api/notes.md
浏览文件 @
c1467f5d
...
...
@@ -89,6 +89,7 @@ Parameters:
-
`id`
(required) - The ID of a project
-
`issue_id`
(required) - The ID of an issue
-
`body`
(required) - The content of a note
-
`created_at`
(optional) - Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
### Modify existing issue note
...
...
lib/api/notes.rb
浏览文件 @
c1467f5d
...
...
@@ -61,6 +61,7 @@ module API
# id (required) - The ID of a project
# noteable_id (required) - The ID of an issue or snippet
# body (required) - The content of a note
# created_at (optional) - The date
# Example Request:
# POST /projects/:id/issues/:noteable_id/notes
# POST /projects/:id/snippets/:noteable_id/notes
...
...
@@ -73,6 +74,10 @@ module API
noteable_id:
params
[
noteable_id_str
]
}
if
params
[
:created_at
]
&&
(
current_user
.
is_admin?
||
user_project
.
owner
==
current_user
)
opts
[
:created_at
]
=
params
[
:created_at
]
end
@note
=
::
Notes
::
CreateService
.
new
(
user_project
,
current_user
,
opts
).
execute
if
@note
.
valid?
...
...
spec/requests/api/notes_spec.rb
浏览文件 @
c1467f5d
...
...
@@ -158,6 +158,19 @@ describe API::API, api: true do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
),
body:
'hi!'
expect
(
response
.
status
).
to
eq
(
401
)
end
context
'when an admin or owner makes the request'
do
it
'accepts the creation date to be set'
do
creation_time
=
2
.
weeks
.
ago
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
'hi!'
,
created_at:
creation_time
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_within
(
1
.
second
).
of
(
creation_time
)
end
end
end
context
"when noteable is a Snippet"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录