Commit ee096d64 authored by Alper Akgun's avatar Alper Akgun

Merge branch 'dblessing_remove_cascading_feature_flag' into 'master'

Remove cascading_namespace_settings feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!64347
parents f39f7d41 ef2c2c8d
......@@ -56,10 +56,6 @@ module NamespacesHelper
namespaces_options(selected, **options)
end
def cascading_namespace_settings_enabled?
NamespaceSetting.cascading_settings_feature_enabled?
end
def cascading_namespace_settings_popover_data(attribute, group, settings_path_helper)
locked_by_ancestor = group.namespace_settings.public_send("#{attribute}_locked_by_ancestor?") # rubocop:disable GitlabSecurity/PublicSend
......
......@@ -24,10 +24,6 @@ module CascadingNamespaceSettingAttribute
include Gitlab::Utils::StrongMemoize
class_methods do
def cascading_settings_feature_enabled?
::Feature.enabled?(:cascading_namespace_settings, default_enabled: true)
end
private
# Facilitates the cascading lookup of values and,
......@@ -82,8 +78,6 @@ module CascadingNamespaceSettingAttribute
def define_attr_reader(attribute)
define_method(attribute) do
strong_memoize(attribute) do
next self[attribute] unless self.class.cascading_settings_feature_enabled?
next self[attribute] if will_save_change_to_attribute?(attribute)
next locked_value(attribute) if cascading_attribute_locked?(attribute, include_self: false)
next self[attribute] unless self[attribute].nil?
......@@ -189,7 +183,6 @@ module CascadingNamespaceSettingAttribute
end
def locked_ancestor(attribute)
return unless self.class.cascading_settings_feature_enabled?
return unless namespace.has_parent?
strong_memoize(:"#{attribute}_locked_ancestor") do
......@@ -202,14 +195,10 @@ module CascadingNamespaceSettingAttribute
end
def locked_by_ancestor?(attribute)
return false unless self.class.cascading_settings_feature_enabled?
locked_ancestor(attribute).present?
end
def locked_by_application_setting?(attribute)
return false unless self.class.cascading_settings_feature_enabled?
Gitlab::CurrentSettings.public_send("lock_#{attribute}") # rubocop:disable GitlabSecurity/PublicSend
end
......
......@@ -3,7 +3,7 @@
- setting_locked = local_assigns.fetch(:setting_locked, false)
- help_text = local_assigns.fetch(:help_text, s_('CascadingSettings|Subgroups cannot change this setting.'))
- return unless attribute && group && form && cascading_namespace_settings_enabled?
- return unless attribute && group && form
- return if setting_locked
- lock_attribute = "lock_#{attribute}"
......
---
name: cascading_namespace_settings
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55678
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/327230
milestone: '13.11'
type: development
group: group::access
default_enabled: true
......@@ -13,18 +13,10 @@ module Groups
private
def delayed_project_removal_i18n_string
if cascading_namespace_settings_enabled?
if current_user&.can_admin_all_resources?
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings. Inherited by subgroups.')
else
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups.')
end
if current_user&.can_admin_all_resources?
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings. Inherited by subgroups.')
else
if current_user&.can_admin_all_resources?
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings.')
else
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay.')
end
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups.')
end
end
end
......
......@@ -13,18 +13,15 @@ RSpec.describe Groups::SettingsHelper do
settings_path = '/admin/application_settings/general#js-visibility-settings'
where(:is_cascading_namespace_settings_enabled, :is_admin, :expected) do
true | true | "Projects will be permanently deleted after a 7-day delay. This delay can be <a href=\"#{settings_path}\">customized by an admin</a> in instance settings. Inherited by subgroups."
true | false | 'Projects will be permanently deleted after a 7-day delay. Inherited by subgroups.'
false | true | "Projects will be permanently deleted after a 7-day delay. This delay can be <a href=\"#{settings_path}\">customized by an admin</a> in instance settings."
false | false | 'Projects will be permanently deleted after a 7-day delay.'
where(:is_admin, :expected) do
true | "Projects will be permanently deleted after a 7-day delay. This delay can be <a href=\"#{settings_path}\">customized by an admin</a> in instance settings. Inherited by subgroups."
false | 'Projects will be permanently deleted after a 7-day delay. Inherited by subgroups.'
end
with_them do
before do
stub_application_setting(deletion_adjourned_period: 7)
allow(helper).to receive(:general_admin_application_settings_path).with(anchor: 'js-visibility-settings').and_return(settings_path)
stub_feature_flags(cascading_namespace_settings: is_cascading_namespace_settings_enabled)
if is_admin
allow(helper).to receive(:current_user).and_return(admin)
......
......@@ -15727,15 +15727,9 @@ msgstr ""
msgid "GroupSettings|Prevent sharing a project within %{group} with other groups"
msgstr ""
msgid "GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay."
msgstr ""
msgid "GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups."
msgstr ""
msgid "GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings."
msgstr ""
msgid "GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings. Inherited by subgroups."
msgstr ""
......
......@@ -195,26 +195,6 @@ RSpec.describe NamespacesHelper do
end
end
describe '#cascading_namespace_settings_enabled?' do
subject { helper.cascading_namespace_settings_enabled? }
context 'when `cascading_namespace_settings` feature flag is enabled' do
it 'returns `true`' do
expect(subject).to be(true)
end
end
context 'when `cascading_namespace_settings` feature flag is disabled' do
before do
stub_feature_flags(cascading_namespace_settings: false)
end
it 'returns `false`' do
expect(subject).to be(false)
end
end
end
describe '#cascading_namespace_settings_popover_data' do
attribute = :delayed_project_removal
......
......@@ -17,18 +17,6 @@ RSpec.describe NamespaceSetting, 'CascadingNamespaceSettingAttribute' do
describe '#delayed_project_removal' do
subject(:delayed_project_removal) { subgroup_settings.delayed_project_removal }
context 'when the feature is disabled' do
before do
stub_feature_flags(cascading_namespace_settings: false)
group_settings.update!(delayed_project_removal: true)
end
it 'does not cascade' do
expect(delayed_project_removal).to eq(nil)
end
end
context 'when there is no parent' do
context 'and the value is not nil' do
before do
......@@ -192,16 +180,6 @@ RSpec.describe NamespaceSetting, 'CascadingNamespaceSettingAttribute' do
end
end
context 'when the feature is disabled' do
before do
stub_feature_flags(cascading_namespace_settings: false)
group_settings.update!(delayed_project_removal: true)
end
it_behaves_like 'not locked'
end
context 'when attribute is locked by self' do
before do
subgroup_settings.update!(lock_delayed_project_removal: true)
......
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