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
051c1387
Commit
051c1387
authored
Jun 01, 2021
by
Marcel Stör
Committed by
Shinya Maeda
Jun 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply 2 suggestion(s) to 1 file(s)
parent
687a7cc9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
17 deletions
+17
-17
doc/api/releases/index.md
doc/api/releases/index.md
+4
-4
lib/api/entities/release.rb
lib/api/entities/release.rb
+1
-1
lib/api/releases.rb
lib/api/releases.rb
+4
-4
spec/lib/api/entities/release_spec.rb
spec/lib/api/entities/release_spec.rb
+4
-4
spec/requests/api/releases_spec.rb
spec/requests/api/releases_spec.rb
+4
-4
No files found.
doc/api/releases/index.md
View file @
051c1387
...
...
@@ -10,8 +10,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> - Using this API you can manipulate GitLab [Release](../../user/project/releases/index.md) entries.
> - For manipulating links as a release asset, see [Release Links API](links.md).
> - Release Evidences were [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/26019) in GitLab 12.5.
> - `description_html` became an
d opt-in field [in GitLab 13.12 for performance reason
](https://gitlab.com/gitlab-org/gitlab/-/issues/299447).
Please pass
`render_html`
option if you need
.
> - `description_html` became an
opt-in field [with GitLab 13.12 for performance reasons
](https://gitlab.com/gitlab-org/gitlab/-/issues/299447).
Please pass
the
`include_html_description`
query string parameter if you need it
.
## List Releases
...
...
@@ -26,7 +26,7 @@ GET /projects/:id/releases
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
../README.md#namespaced-path-encoding
)
. |
|
`order_by`
| string | no | The field to use as order. Either
`released_at`
(default) or
`created_at`
. |
|
`sort`
| string | no | The direction of the order. Either
`desc`
(default) for descending order or
`asc`
for ascending order. |
|
`
render_html
`
| boolean | no | If
`true`
, a response includes HTML rendered Markdown of the release description. |
|
`
include_html_description
`
| boolean | no | If
`true`
, a response includes HTML rendered Markdown of the release description. |
Example request:
...
...
@@ -230,7 +230,7 @@ GET /projects/:id/releases/:tag_name
| ------------- | -------------- | -------- | ----------------------------------------------------------------------------------- |
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
../README.md#namespaced-path-encoding
)
. |
|
`tag_name`
| string | yes | The Git tag the release is associated with. |
|
`
render_html
`
| boolean | no | If
`true`
, a response includes HTML rendered Markdown of the release description. |
|
`
include_html_description
`
| boolean | no | If
`true`
, a response includes HTML rendered Markdown of the release description. |
Example request:
...
...
lib/api/entities/release.rb
View file @
051c1387
...
...
@@ -8,7 +8,7 @@ module API
expose
:name
expose
:tag
,
as: :tag_name
,
if:
->
(
_
,
_
)
{
can_download_code?
}
expose
:description
expose
:description_html
,
if:
->
(
_
,
options
)
{
options
[
:
render_html
]
}
do
|
entity
|
expose
:description_html
,
if:
->
(
_
,
options
)
{
options
[
:
include_html_description
]
}
do
|
entity
|
MarkupHelper
.
markdown_field
(
entity
,
:description
,
current_user:
options
[
:current_user
])
end
expose
:created_at
...
...
lib/api/releases.rb
View file @
051c1387
...
...
@@ -29,7 +29,7 @@ module API
desc:
'Return releases ordered by `released_at` or `created_at`.'
optional
:sort
,
type:
String
,
values:
%w[asc desc]
,
default:
'desc'
,
desc:
'Return releases sorted in `asc` or `desc` order.'
optional
:
render_html
,
type:
Boolean
,
optional
:
include_html_description
,
type:
Boolean
,
desc:
'If `true`, a response includes HTML rendered markdown of the release description.'
end
get
':id/releases'
do
...
...
@@ -46,7 +46,7 @@ module API
cache_context:
->
(
_
)
{
"user:{
#{
current_user
&
.
id
}
}"
},
expires_in:
5
.
minutes
,
current_user:
current_user
,
render_html:
params
[
:render_html
]
include_html_description:
params
[
:include_html_description
]
end
desc
'Get a single project release'
do
...
...
@@ -56,13 +56,13 @@ module API
end
params
do
requires
:tag_name
,
type:
String
,
desc:
'The name of the tag'
,
as: :tag
optional
:
render_html
,
type:
Boolean
,
optional
:
include_html_description
,
type:
Boolean
,
desc:
'If `true`, a response includes HTML rendered markdown of the release description.'
end
get
':id/releases/:tag_name'
,
requirements:
RELEASE_ENDPOINT_REQUIREMENTS
do
authorize_download_code!
present
release
,
with:
Entities
::
Release
,
current_user:
current_user
,
render_html:
params
[
:render_html
]
present
release
,
with:
Entities
::
Release
,
current_user:
current_user
,
include_html_description:
params
[
:include_html_description
]
end
desc
'Create a new release'
do
...
...
spec/lib/api/entities/release_spec.rb
View file @
051c1387
...
...
@@ -8,8 +8,8 @@ RSpec.describe API::Entities::Release do
let
(
:release
)
{
create
(
:release
,
project:
project
)
}
let
(
:evidence
)
{
release
.
evidences
.
first
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:entity
)
{
described_class
.
new
(
release
,
current_user:
user
,
render_html:
render_html
).
as_json
}
let
(
:
render_html
)
{
false
}
let
(
:entity
)
{
described_class
.
new
(
release
,
current_user:
user
,
include_html_description:
include_html_description
).
as_json
}
let
(
:
include_html_description
)
{
false
}
before
do
::
Releases
::
CreateEvidenceService
.
new
(
release
).
execute
...
...
@@ -59,8 +59,8 @@ RSpec.describe API::Entities::Release do
expect
(
description_html
).
to
be_nil
end
context
'when
render_html
option is true'
do
let
(
:
render_html
)
{
true
}
context
'when
include_html_description
option is true'
do
let
(
:
include_html_description
)
{
true
}
it
'renders special references if current user has access'
do
project
.
add_reporter
(
user
)
...
...
spec/requests/api/releases_spec.rb
View file @
051c1387
...
...
@@ -114,9 +114,9 @@ RSpec.describe API::Releases do
expect
(
json_response
.
second
[
'tag_path'
]).
to
eq
(
"/
#{
release_1
.
project
.
full_path
}
/-/tags/
#{
release_1
.
tag
}
"
)
end
context
'when
render_html
option is true'
do
context
'when
include_html_description
option is true'
do
it
'includes description_html field'
do
get
api
(
"/projects/
#{
project
.
id
}
/releases"
,
maintainer
),
params:
{
render_html
:
true
}
get
api
(
"/projects/
#{
project
.
id
}
/releases"
,
maintainer
),
params:
{
include_html_description
:
true
}
expect
(
json_response
.
map
{
|
h
|
h
[
'description_html'
]
})
.
to
contain_exactly
(
instance_of
(
String
),
instance_of
(
String
))
...
...
@@ -424,9 +424,9 @@ RSpec.describe API::Releases do
end
end
context
'when
render_html
option is true'
do
context
'when
include_html_description
option is true'
do
it
'includes description_html field'
do
get
api
(
"/projects/
#{
project
.
id
}
/releases/v0.1"
,
maintainer
),
params:
{
render_html
:
true
}
get
api
(
"/projects/
#{
project
.
id
}
/releases/v0.1"
,
maintainer
),
params:
{
include_html_description
:
true
}
expect
(
json_response
[
'description_html'
]).
to
be_instance_of
(
String
)
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