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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
28a7fe25
Commit
28a7fe25
authored
Apr 05, 2016
by
Michael Greene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow back dating issues on update
parent
e17f79fd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
7 deletions
+23
-7
CHANGELOG
CHANGELOG
+1
-1
doc/api/issues.md
doc/api/issues.md
+1
-0
lib/api/issues.rb
lib/api/issues.rb
+5
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+16
-4
No files found.
CHANGELOG
View file @
28a7fe25
...
@@ -18,11 +18,11 @@ v 8.7.0 (unreleased)
...
@@ -18,11 +18,11 @@ 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)
- Expose label description in API (Mariusz Jachimowicz)
- Expose label description in API (Mariusz Jachimowicz)
- Allow back dating on issues when created through the API
- API: Ability to update a group (Robert Schilling)
- API: Ability to update a group (Robert Schilling)
- API: Ability to move issues (Robert Schilling)
- API: Ability to move issues (Robert Schilling)
- Fix Error 500 after renaming a project path (Stan Hu)
- Fix Error 500 after renaming a project path (Stan Hu)
- Fix a bug whith trailing slash in teamcity_url (Charles May)
- Fix a bug whith trailing slash in teamcity_url (Charles May)
- Allow back dating on issues when created or updated through the API
- Fix avatar stretching by providing a cropping feature
- Fix avatar stretching by providing a cropping feature
- API: Expose `subscribed` for issues and merge requests (Robert Schilling)
- API: Expose `subscribed` for issues and merge requests (Robert Schilling)
- Allow SAML to handle external users based on user's information !3530
- Allow SAML to handle external users based on user's information !3530
...
...
doc/api/issues.md
View file @
28a7fe25
...
@@ -298,6 +298,7 @@ PUT /projects/:id/issues/:issue_id
...
@@ -298,6 +298,7 @@ PUT /projects/:id/issues/:issue_id
|
`milestone_id`
| integer | no | The ID of a milestone to assign the issue to |
|
`milestone_id`
| integer | no | The ID of a milestone to assign the issue to |
|
`labels`
| string | no | Comma-separated label names for an issue |
|
`labels`
| string | no | Comma-separated label names for an issue |
|
`state_event`
| string | no | The state event of an issue. Set
`close`
to close the issue and
`reopen`
to reopen it |
|
`state_event`
| string | no | The state event of an issue. Set
`close`
to close the issue and
`reopen`
to reopen it |
|
`updated_at`
| string | no | Date time string, ISO 8601 formatted, e.g.
`2016-03-11T03:45:40Z`
|
```
bash
```
bash
curl
-X
PUT
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/projects/4/issues/85?state_event
=
close
curl
-X
PUT
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/projects/4/issues/85?state_event
=
close
...
...
lib/api/issues.rb
View file @
28a7fe25
...
@@ -117,7 +117,7 @@ module API
...
@@ -117,7 +117,7 @@ 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
# created_at (optional) -
Date time string, ISO 8601 formatted
# Example Request:
# Example Request:
# POST /projects/:id/issues
# POST /projects/:id/issues
post
":id/issues"
do
post
":id/issues"
do
...
@@ -166,12 +166,15 @@ module API
...
@@ -166,12 +166,15 @@ module API
# 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
# state_event (optional) - The state event of an issue (close|reopen)
# state_event (optional) - The state event of an issue (close|reopen)
# updated_at (optional) - Date time string, ISO 8601 formatted
# Example Request:
# Example Request:
# PUT /projects/:id/issues/:issue_id
# PUT /projects/:id/issues/:issue_id
put
":id/issues/:issue_id"
do
put
":id/issues/:issue_id"
do
issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
authorize!
:update_issue
,
issue
authorize!
:update_issue
,
issue
attrs
=
attributes_for_keys
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:state_event
]
keys
=
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:state_event
]
keys
<<
:updated_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 @
28a7fe25
...
@@ -321,13 +321,13 @@ describe API::API, api: true do
...
@@ -321,13 +321,13 @@ describe API::API, api: true do
end
end
context
'when an admin or owner makes the request'
do
context
'when an admin or owner makes the request'
do
it
"accepts the creation date to be set"
do
it
'accepts the creation date to be set'
do
creation_time
=
2
.
weeks
.
ago
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
title:
'new issue'
,
labels:
'label, label2'
,
created_at:
2
.
weeks
.
ago
title:
'new issue'
,
labels:
'label, label2'
,
created_at:
creation_time
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
# this take about a second, so probably not equal
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_within
(
1
.
second
).
of
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be
<=
2
.
weeks
.
ago
end
end
end
end
end
end
...
@@ -478,6 +478,18 @@ describe API::API, api: true do
...
@@ -478,6 +478,18 @@ describe API::API, api: true do
expect
(
json_response
[
'labels'
]).
to
include
'label2'
expect
(
json_response
[
'labels'
]).
to
include
'label2'
expect
(
json_response
[
'state'
]).
to
eq
"closed"
expect
(
json_response
[
'state'
]).
to
eq
"closed"
end
end
context
'when an admin or owner makes the request'
do
it
'accepts the update date to be set'
do
update_time
=
2
.
weeks
.
ago
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
labels:
'label3'
,
state_event:
'close'
,
updated_at:
update_time
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'labels'
]).
to
include
'label3'
expect
(
Time
.
parse
(
json_response
[
'updated_at'
])).
to
be_within
(
1
.
second
).
of
(
update_time
)
end
end
end
end
describe
"DELETE /projects/:id/issues/:issue_id"
do
describe
"DELETE /projects/:id/issues/:issue_id"
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