Commit adc9959c authored by Shinya Maeda's avatar Shinya Maeda Committed by Sean McGivern

Remove Redundant Description HTML field from Release API

This commit removes the redundant description_html field
from the Release Rest API.
parent 9bf53bbc
---
name: remove_description_html_in_release_api
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60380
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329188
milestone: '13.12'
type: development
group: group::release
default_enabled: false
---
name: remove_description_html_in_release_api_override
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60380
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329188
milestone: '13.12'
type: development
group: group::release
default_enabled: false
...@@ -8,7 +8,7 @@ module API ...@@ -8,7 +8,7 @@ module API
expose :name expose :name
expose :tag, as: :tag_name, if: ->(_, _) { can_download_code? } expose :tag, as: :tag_name, if: ->(_, _) { can_download_code? }
expose :description expose :description
expose :description_html do |entity| expose :description_html, unless: ->(_, _) { remove_description_html? } do |entity|
MarkupHelper.markdown_field(entity, :description, current_user: options[:current_user]) MarkupHelper.markdown_field(entity, :description, current_user: options[:current_user])
end end
expose :created_at expose :created_at
...@@ -45,6 +45,11 @@ module API ...@@ -45,6 +45,11 @@ module API
def can_read_milestone? def can_read_milestone?
Ability.allowed?(options[:current_user], :read_milestone, object.project) Ability.allowed?(options[:current_user], :read_milestone, object.project)
end 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 end
end end
...@@ -54,18 +54,41 @@ RSpec.describe API::Entities::Release do ...@@ -54,18 +54,41 @@ RSpec.describe API::Entities::Release do
subject(:description_html) { entity.as_json['description_html'] } subject(:description_html) { entity.as_json['description_html'] }
it 'renders special references if current user has access' do it 'is inexistent' do
project.add_reporter(user) expect(description_html).to be_nil
end
context 'when remove_description_html_in_release_api feature flag is disabled' do
before do
stub_feature_flags(remove_description_html_in_release_api: false)
end
it 'renders special references if current user has access' do
project.add_reporter(user)
expect(description_html).to include(issue_path)
expect(description_html).to include(issue_title)
end
expect(description_html).to include(issue_path) it 'does not render special references if current user has no access' do
expect(description_html).to include(issue_title) project.add_guest(user)
expect(description_html).not_to include(issue_path)
expect(description_html).not_to include(issue_title)
end
end end
it 'does not render special references if current user has no access' do context 'when remove_description_html_in_release_api_override feature flag is enabled' do
project.add_guest(user) before do
stub_feature_flags(remove_description_html_in_release_api_override: project)
end
expect(description_html).not_to include(issue_path) it 'renders special references if current user has access' do
expect(description_html).not_to include(issue_title) project.add_reporter(user)
expect(description_html).to include(issue_path)
expect(description_html).to include(issue_title)
end
end end
end end
end end
...@@ -281,6 +281,9 @@ RSpec.configure do |config| ...@@ -281,6 +281,9 @@ RSpec.configure do |config|
# As we're ready to change `master` usages to `main`, let's enable it # As we're ready to change `master` usages to `main`, let's enable it
stub_feature_flags(main_branch_over_master: false) stub_feature_flags(main_branch_over_master: false)
# Selectively disable by actor https://docs.gitlab.com/ee/development/feature_flags/#selectively-disable-by-actor
stub_feature_flags(remove_description_html_in_release_api_override: false)
allow(Gitlab::GitalyClient).to receive(:can_use_disk?).and_return(enable_rugged) allow(Gitlab::GitalyClient).to receive(:can_use_disk?).and_return(enable_rugged)
else else
unstub_all_feature_flags unstub_all_feature_flags
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment