diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-07 17:47:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-07 17:47:00 +0300 |
commit | 08086ff522742c28a6b10e9b2ed71f0af6633e5b (patch) | |
tree | 5a4fde8b23140cb4edf04b24854b53f87085dd42 /lib/api | |
parent | 8f3fbbf0d56091ad87158f61bf2a4e96a7f937e3 (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-ee
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities/release.rb | 7 | ||||
-rw-r--r-- | lib/api/releases.rb | 9 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/api/entities/release.rb b/lib/api/entities/release.rb index 94124352298..056b54674f1 100644 --- a/lib/api/entities/release.rb +++ b/lib/api/entities/release.rb @@ -8,7 +8,7 @@ module API expose :name expose :tag, as: :tag_name, if: ->(_, _) { can_download_code? } expose :description - expose :description_html, unless: ->(_, _) { remove_description_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 @@ -45,11 +45,6 @@ module API def can_read_milestone? Ability.allowed?(options[:current_user], :read_milestone, object.project) end - - def remove_description_html? - ::Feature.enabled?(:remove_description_html_in_release_api, object.project, default_enabled: :yaml) && - ::Feature.disabled?(:remove_description_html_in_release_api_override, object.project) - end end end end diff --git a/lib/api/releases.rb b/lib/api/releases.rb index c65a23e334f..7cd8b442706 100644 --- a/lib/api/releases.rb +++ b/lib/api/releases.rb @@ -29,6 +29,8 @@ 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 :include_html_description, type: Boolean, + desc: 'If `true`, a response includes HTML rendered markdown of the release description.' end get ':id/releases' do releases = ::ReleasesFinder.new(user_project, current_user, declared_params.slice(:order_by, :sort)).execute @@ -43,7 +45,8 @@ module API # context is unnecessary here. cache_context: -> (_) { "user:{#{current_user&.id}}" }, expires_in: 5.minutes, - current_user: current_user + current_user: current_user, + include_html_description: params[:include_html_description] end desc 'Get a single project release' do @@ -53,11 +56,13 @@ module API end params do requires :tag_name, type: String, desc: 'The name of the tag', as: :tag + 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 + present release, with: Entities::Release, current_user: current_user, include_html_description: params[:include_html_description] end desc 'Create a new release' do |