Commit 3e6ccfcb authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'remove-promo-feature-flags' into 'master'

Remove `promo_` implicit licensed feature flags

See merge request gitlab-org/gitlab!41734
parents 52a3a978 f647525a
......@@ -35,7 +35,3 @@ the instance license.
```ruby
License.feature_available?(:feature_symbol)
```
## Enabling promo features on GitLab.com
A paid feature can be made available to everyone on GitLab.com by enabling the feature flag `"promo_#{feature}"`.
......@@ -148,8 +148,6 @@ module EE
end
def feature_available_in_plan?(feature)
return true if ::License.promo_feature_available?(feature)
available_features = strong_memoize(:features_available_in_plan) do
Hash.new do |h, f|
h[f] = (plans.map(&:name) & self.class.plans_with_feature(f)).any?
......
......@@ -298,10 +298,6 @@ class License < ApplicationRecord
Gitlab::CurrentSettings.license_trial_ends_on
end
def promo_feature_available?(feature)
::Feature.enabled?("promo_#{feature}", default_enabled: false)
end
def history
all.sort_by { |license| [license.starts_at, license.created_at, license.expires_at] }.reverse
end
......
......@@ -368,25 +368,6 @@ RSpec.describe Namespace do
end
end
context 'when the feature is temporarily available on the entire instance' do
let(:feature) { :ci_cd_projects }
before do
stub_application_setting_on_object(group, should_check_namespace_plan: true)
stub_feature_flags(promo_ci_cd_projects: true)
end
it 'returns true when the feature is available globally' do
stub_licensed_features(feature => true)
is_expected.to be_truthy
end
it 'returns `false` when the feature is not included in the global license' do
is_expected.to be_falsy
end
end
context 'when feature is disabled by a feature flag' do
it 'returns false' do
stub_feature_flags(feature => false)
......
......@@ -850,26 +850,6 @@ RSpec.describe License do
end
end
describe '#promo_feature_available?' do
subject { described_class.promo_feature_available?(:container_scanning) }
context 'with promo_container_scanning disabled' do
before do
stub_feature_flags(promo_container_scanning: false)
end
it { is_expected.to be_falsey }
end
context 'with promo_container_scanning enabled' do
before do
stub_feature_flags(promo_container_scanning: true)
end
it { is_expected.to be_truthy }
end
end
describe '.history' do
before(:all) do
described_class.delete_all
......
......@@ -809,17 +809,6 @@ RSpec.describe Project do
is_expected.to eq(false)
end
end
context 'with promo feature flag' do
let(:allowed_on_global_license) { true }
before do
project.clear_memoization(:licensed_feature_available)
stub_feature_flags("promo_#{feature}" => true)
end
it { is_expected.to be_truthy }
end
end
end
......
......@@ -37,10 +37,7 @@ module StubbedFeature
# We do `m.call` as we want to validate the execution of method arguments
# and a feature flag state if it is not persisted
unless Feature.persisted_name?(args.first)
# TODO: this is hack to support `promo_feature_available?`
# We enable all feature flags by default unless they are `promo_`
# Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/218667
feature_flag = true unless args.first.to_s.start_with?('promo_')
feature_flag = true
end
feature_flag
......
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