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
Jérome Perrin
gitlab-ce
Commits
473b2612
Commit
473b2612
authored
Mar 25, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Back dating of issues when creating throught the API
parent
43e49f52
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
CHANGELOG
CHANGELOG
+1
-0
doc/api/issues.md
doc/api/issues.md
+1
-0
lib/api/issues.rb
lib/api/issues.rb
+10
-6
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+11
-0
No files found.
CHANGELOG
View file @
473b2612
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.7.0 (unreleased)
v 8.7.0 (unreleased)
- Preserve time notes/comments have been updated at when moving issue
- Preserve time notes/comments have been updated at when moving issue
- Make HTTP(s) label consistent on clone bar (Stan Hu)
- Make HTTP(s) label consistent on clone bar (Stan Hu)
- Allow back dating on issues when created through the API
- Fix avatar stretching by providing a cropping feature
- Fix avatar stretching by providing a cropping feature
v 8.6.2 (unreleased)
v 8.6.2 (unreleased)
...
...
doc/api/issues.md
View file @
473b2612
...
@@ -237,6 +237,7 @@ POST /projects/:id/issues
...
@@ -237,6 +237,7 @@ POST /projects/:id/issues
|
`assignee_id`
| integer | no | The ID of a user to assign issue |
|
`assignee_id`
| integer | no | The ID of a user to assign issue |
|
`milestone_id`
| integer | no | The ID of a milestone to assign issue |
|
`milestone_id`
| integer | no | The ID of a milestone to assign issue |
|
`labels`
| string | no | Comma-separated label names for an issue |
|
`labels`
| string | no | Comma-separated label names for an issue |
|
`created_at`
| string | no | Date time string, ISO 8601 formatted, e.g.
`2016-03-11T03:45:40Z`
|
```
bash
```
bash
curl
-X
POST
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/projects/4/issues?title
=
Issues%20with%20auth&labels
=
bug
curl
-X
POST
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/projects/4/issues?title
=
Issues%20with%20auth&labels
=
bug
...
...
lib/api/issues.rb
View file @
473b2612
...
@@ -117,11 +117,15 @@ module API
...
@@ -117,11 +117,15 @@ module API
# assignee_id (optional) - The ID of a user to assign issue
# assignee_id (optional) - The ID of a user to assign issue
# milestone_id (optional) - The ID of a milestone to assign issue
# milestone_id (optional) - The ID of a milestone to assign issue
# labels (optional) - The labels of an issue
# labels (optional) - The labels of an issue
# created_at (optional) - The date
# Example Request:
# Example Request:
# POST /projects/:id/issues
# POST /projects/:id/issues
post
":id/issues"
do
post
":id/issues"
do
required_attributes!
[
:title
]
required_attributes!
[
:title
]
attrs
=
attributes_for_keys
[
:title
,
:description
,
:assignee_id
,
:milestone_id
]
keys
=
[
:title
,
:description
,
:assignee_id
,
:milestone_id
]
keys
<<
:created_at
if
current_user
.
admin?
||
user_project
.
owner
==
current_user
attrs
=
attributes_for_keys
(
keys
)
# Validate label names in advance
# Validate label names in advance
if
(
errors
=
validate_label_params
(
params
)).
any?
if
(
errors
=
validate_label_params
(
params
)).
any?
...
...
spec/requests/api/issues_spec.rb
View file @
473b2612
...
@@ -318,6 +318,17 @@ describe API::API, api: true do
...
@@ -318,6 +318,17 @@ describe API::API, api: true do
'is too long (maximum is 255 characters)'
'is too long (maximum is 255 characters)'
])
])
end
end
context
'when an admin or owner makes the request'
do
it
"accepts the creation date to be set"
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
title:
'new issue'
,
labels:
'label, label2'
,
created_at:
2
.
weeks
.
ago
expect
(
response
.
status
).
to
eq
(
201
)
# this take about a second, so probably not equal
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be
<=
2
.
weeks
.
ago
end
end
end
end
describe
'POST /projects/:id/issues with spam filtering'
do
describe
'POST /projects/:id/issues with spam filtering'
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