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
c0845e83
Commit
c0845e83
authored
Sep 16, 2017
by
Vitaliy @blackst0ne Klachkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'closed_at' attribute to Issues API
parent
20295b3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
2 deletions
+26
-2
changelogs/unreleased/add_closed_at_attribute.yml
changelogs/unreleased/add_closed_at_attribute.yml
+5
-0
doc/api/issues.md
doc/api/issues.md
+9
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/fixtures/api/schemas/public_api/v4/issues.json
spec/fixtures/api/schemas/public_api/v4/issues.json
+1
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+10
-1
No files found.
changelogs/unreleased/add_closed_at_attribute.yml
0 → 100644
View file @
c0845e83
---
title
:
Add 'closed_at' attribute to Issues API
merge_request
:
14316
author
:
Vitaliy @blackst0ne Klachkov
type
:
added
doc/api/issues.md
View file @
c0845e83
...
...
@@ -95,6 +95,7 @@ Example response:
"username"
:
"root"
},
"updated_at"
:
"2016-01-04T15:31:51.081Z"
,
"closed_at"
:
null
,
"id"
:
76
,
"title"
:
"Consequatur vero maxime deserunt laboriosam est voluptas dolorem."
,
"created_at"
:
"2016-01-04T15:31:51.081Z"
,
...
...
@@ -205,6 +206,7 @@ Example response:
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"created_at"
:
"2016-01-04T15:31:46.176Z"
,
"closed_at"
:
null
,
"user_notes_count"
:
1
,
"due_date"
:
null
,
"web_url"
:
"http://example.com/example/example/issues/1"
,
...
...
@@ -311,6 +313,7 @@ Example response:
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"created_at"
:
"2016-01-04T15:31:46.176Z"
,
"closed_at"
:
"2016-01-05T15:31:46.176Z"
,
"user_notes_count"
:
1
,
"due_date"
:
"2016-07-22"
,
"web_url"
:
"http://example.com/example/example/issues/1"
,
...
...
@@ -358,7 +361,8 @@ Example response:
"id"
:
11
,
"title"
:
"v3.0"
,
"created_at"
:
"2016-01-04T15:31:39.788Z"
,
"updated_at"
:
"2016-01-04T15:31:39.788Z"
"updated_at"
:
"2016-01-04T15:31:39.788Z"
,
"closed_at"
:
"2016-01-05T15:31:46.176Z"
},
"author"
:
{
"state"
:
"active"
,
...
...
@@ -465,6 +469,7 @@ Example response:
},
"description"
:
null
,
"updated_at"
:
"2016-01-07T12:44:33.959Z"
,
"closed_at"
:
null
,
"milestone"
:
null
,
"subscribed"
:
true
,
"user_notes_count"
:
0
,
...
...
@@ -533,6 +538,7 @@ Example response:
"project_id"
:
4
,
"description"
:
null
,
"updated_at"
:
"2016-01-07T12:55:16.213Z"
,
"closed_at"
:
"2016-01-08T12:55:16.213Z"
,
"iid"
:
15
,
"labels"
:
[
"bug"
...
...
@@ -615,6 +621,7 @@ Example response:
"state"
:
"opened"
,
"created_at"
:
"2016-04-05T21:41:45.652Z"
,
"updated_at"
:
"2016-04-07T12:20:17.596Z"
,
"closed_at"
:
null
,
"labels"
:
[],
"milestone"
:
null
,
"assignees"
:
[{
...
...
@@ -692,6 +699,7 @@ Example response:
"state"
:
"opened"
,
"created_at"
:
"2016-04-05T21:41:45.652Z"
,
"updated_at"
:
"2016-04-07T12:20:17.596Z"
,
"closed_at"
:
null
,
"labels"
:
[],
"milestone"
:
null
,
"assignees"
:
[{
...
...
lib/api/entities.rb
View file @
c0845e83
...
...
@@ -332,6 +332,7 @@ module API
end
class
IssueBasic
<
ProjectEntity
expose
:closed_at
expose
:labels
do
|
issue
,
options
|
# Avoids an N+1 query since labels are preloaded
issue
.
labels
.
map
(
&
:title
).
sort
...
...
spec/fixtures/api/schemas/public_api/v4/issues.json
View file @
c0845e83
...
...
@@ -9,6 +9,7 @@
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"closed_at"
:
{
"type"
:
"date"
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"labels"
:
{
...
...
spec/requests/api/issues_spec.rb
View file @
c0845e83
...
...
@@ -22,7 +22,8 @@ describe API::Issues, :mailer do
state: :closed
,
milestone:
milestone
,
created_at:
generate
(
:past_time
),
updated_at:
3
.
hours
.
ago
updated_at:
3
.
hours
.
ago
,
closed_at:
1
.
hour
.
ago
end
let!
(
:confidential_issue
)
do
create
:issue
,
...
...
@@ -738,6 +739,7 @@ describe API::Issues, :mailer do
expect
(
json_response
[
'title'
]).
to
eq
(
issue
.
title
)
expect
(
json_response
[
'description'
]).
to
eq
(
issue
.
description
)
expect
(
json_response
[
'state'
]).
to
eq
(
issue
.
state
)
expect
(
json_response
[
'closed_at'
]).
to
be_falsy
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'updated_at'
]).
to
be_present
expect
(
json_response
[
'labels'
]).
to
eq
(
issue
.
label_names
)
...
...
@@ -748,6 +750,13 @@ describe API::Issues, :mailer do
expect
(
json_response
[
'confidential'
]).
to
be_falsy
end
it
"exposes the 'closed_at' attribute"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
closed_issue
.
iid
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'closed_at'
]).
to
be_present
end
context
'links exposure'
do
it
'exposes related resources full URIs'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
...
...
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