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
90ee3199
Commit
90ee3199
authored
Sep 20, 2019
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose web_url for epics on API
Expose web_url field on API to be consistent with other API responses.
parent
11472efd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
10 deletions
+28
-10
changelogs/unreleased/issue_11241.yml
changelogs/unreleased/issue_11241.yml
+5
-0
doc/api/epics.md
doc/api/epics.md
+4
-4
ee/app/models/ee/epic.rb
ee/app/models/ee/epic.rb
+1
-1
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+8
-1
ee/spec/fixtures/api/schemas/public_api/v4/epic.json
ee/spec/fixtures/api/schemas/public_api/v4/epic.json
+1
-0
ee/spec/requests/api/epics_spec.rb
ee/spec/requests/api/epics_spec.rb
+9
-4
No files found.
changelogs/unreleased/issue_11241.yml
0 → 100644
View file @
90ee3199
---
title
:
Expose web_url for epics on API
merge_request
:
author
:
type
:
changed
doc/api/epics.md
View file @
90ee3199
...
...
@@ -67,7 +67,7 @@ Example response:
"title"
:
"Accusamus iste et ullam ratione voluptatem omnis debitis dolor est."
,
"description"
:
"Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum."
,
"state"
:
"opened"
,
"web_
edit_
url"
:
"http://localhost:3001/groups/test/-/epics/4"
,
"web_url"
:
"http://localhost:3001/groups/test/-/epics/4"
,
"reference"
:
"&4"
,
"author"
:
{
"id"
:
10
,
...
...
@@ -122,7 +122,7 @@ Example response:
"title"
:
"Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non."
,
"description"
:
"Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum."
,
"state"
:
"opened"
,
"web_
edit_
url"
:
"http://localhost:3001/groups/test/-/epics/5"
,
"web_url"
:
"http://localhost:3001/groups/test/-/epics/5"
,
"reference"
:
"&5"
,
"author"
:{
"id"
:
7
,
...
...
@@ -188,7 +188,7 @@ Example response:
"title"
:
"Epic"
,
"description"
:
"Epic description"
,
"state"
:
"opened"
,
"web_
edit_url"
:
"http://localhost:3001/groups/test/-/epics/6
"
,
"web_
url"
:
"http://localhost:3001/groups/test/-/epics/5
"
,
"reference"
:
"&6"
,
"author"
:
{
"name"
:
"Alexandra Bashirian"
,
...
...
@@ -255,7 +255,7 @@ Example response:
"title"
:
"New Title"
,
"description"
:
"Epic description"
,
"state"
:
"opened"
,
"web_
edit_url"
:
"http://localhost:3001/groups/test/-/epics/6
"
,
"web_
url"
:
"http://localhost:3001/groups/test/-/epics/5
"
,
"reference"
:
"&6"
,
"author"
:
{
"name"
:
"Alexandra Bashirian"
,
...
...
ee/app/models/ee/epic.rb
View file @
90ee3199
...
...
@@ -77,7 +77,7 @@ module EE
reorder
(
'relative_position ASC'
,
'id DESC'
)
end
scope
:with_api_entity_associations
,
->
{
preload
(
:author
,
:labels
,
:group
)
}
scope
:with_api_entity_associations
,
->
{
preload
(
:author
,
:labels
,
group: :route
)
}
MAX_HIERARCHY_DEPTH
=
5
...
...
ee/lib/ee/api/entities.rb
View file @
90ee3199
...
...
@@ -241,6 +241,8 @@ module EE
class
Epic
<
Grape
::
Entity
can_admin_epic
=
->
(
epic
,
opts
)
{
Ability
.
allowed?
(
opts
[
:user
],
:admin_epic
,
epic
)
}
epic_url
=
->
(
epic
)
{
::
Gitlab
::
Routing
.
url_helpers
.
group_epic_path
(
epic
.
group
,
epic
)
}
expose
:id
expose
:iid
expose
:group_id
...
...
@@ -257,7 +259,12 @@ module EE
expose
:due_date_fixed
,
:due_date_from_milestones
,
if:
can_admin_epic
expose
:state
expose
:web_edit_url
,
if:
can_admin_epic
do
|
epic
|
::
Gitlab
::
Routing
.
url_helpers
.
group_epic_path
(
epic
.
group
,
epic
)
epic_url
.
call
(
epic
)
end
# web_edit_url is already exposed and has the same value of web_url
# this field has been added again with other name to be consistent with other API responses
expose
:web_url
do
|
epic
|
epic_url
.
call
(
epic
)
end
expose
:reference
,
if:
{
with_reference:
true
}
do
|
epic
|
epic
.
to_reference
(
full:
true
)
...
...
ee/spec/fixtures/api/schemas/public_api/v4/epic.json
View file @
90ee3199
...
...
@@ -40,6 +40,7 @@
"created_at"
:
{
"type"
:
[
"string"
,
"null"
]
},
"updated_at"
:
{
"type"
:
[
"string"
,
"null"
]
},
"web_edit_url"
:
{
"type"
:
"string"
},
"web_url"
:
{
"type"
:
"string"
},
"reference"
:
{
"type"
:
"string"
}
},
"required"
:
[
...
...
ee/spec/requests/api/epics_spec.rb
View file @
90ee3199
...
...
@@ -63,6 +63,7 @@ describe API::Epics do
describe
'GET /groups/:id/epics'
do
let
(
:url
)
{
"/groups/
#{
group
.
path
}
/epics"
}
let
(
:params
)
{
{
include_descendant_groups:
true
}
}
it_behaves_like
'error requests'
...
...
@@ -70,7 +71,7 @@ describe API::Epics do
before
do
stub_licensed_features
(
epics:
true
)
get
api
(
url
,
user
)
get
api
(
url
,
user
)
,
params:
params
end
it
'returns 200 status'
do
...
...
@@ -85,15 +86,19 @@ describe API::Epics do
epic
# Avoid polluting queries with inserts for personal access token
pat
=
create
(
:personal_access_token
,
user:
user
)
subgroup_1
=
create
(
:group
,
parent:
group
)
subgroup_2
=
create
(
:group
,
parent:
subgroup_1
)
create
(
:epic
,
group:
subgroup_1
)
create
(
:epic
,
group:
subgroup_2
)
control
=
ActiveRecord
::
QueryRecorder
.
new
(
skip_cached:
false
)
do
get
api
(
url
,
personal_access_token:
pat
)
end
get
api
(
url
,
personal_access_token:
pat
)
,
params:
params
end
.
count
label_2
=
create
(
:label
)
create_list
(
:labeled_epic
,
2
,
group:
group
,
labels:
[
label_2
])
expect
{
get
api
(
url
,
personal_access_token:
pat
)
}.
not_to
exceed_all_query_limit
(
control
)
expect
{
get
api
(
url
,
personal_access_token:
pat
)
,
params:
params
}.
not_to
exceed_all_query_limit
(
control
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
...
...
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