Commit 2f7171ce authored by rpereira2's avatar rpereira2

Move all user callout enums to FOSS

Since the recommendation is to define all enums in FOSS, move the EE
only enums into FOSS. Since the enums were moved into concerns so that
it is easier to extend the Hash in EE, this commit moves all the enums
back into the model.
parent 9063dea6
# frozen_string_literal: true
module Enums
module UserCallout
# Returns the `Hash` to use for the `feature_name` enum in the `UserCallout`
# model.
#
# This method is separate from the `UserCallout` model so that it can be
# extended by EE.
#
# If you are going to add new items to this hash, check that you're not going
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/concerns/ee/enums/user_callout.rb
def self.feature_names
{
gke_cluster_integration: 1,
gcp_signup_offer: 2,
cluster_security_warning: 3,
suggest_popover_dismissed: 9,
tabs_position_highlight: 10,
webhooks_moved: 13,
service_templates_deprecated: 14,
admin_integrations_moved: 15,
web_ide_alert_dismissed: 16,
personal_access_token_expiry: 21, # EE-only
suggest_pipeline: 22,
customize_homepage: 23,
feature_flags_new_version: 24
}
end
end
end
Enums::UserCallout.prepend_if_ee('EE::Enums::UserCallout')
......@@ -3,9 +3,30 @@
class UserCallout < ApplicationRecord
belongs_to :user
# We use `Enums::UserCallout.feature_names` here so that EE can more easily
# extend this `Hash` with new values.
enum feature_name: Enums::UserCallout.feature_names
enum feature_name: {
gke_cluster_integration: 1,
gcp_signup_offer: 2,
cluster_security_warning: 3,
gold_trial: 4, # EE-only
geo_enable_hashed_storage: 5, # EE-only
geo_migrate_hashed_storage: 6, # EE-only
canary_deployment: 7, # EE-only
gold_trial_billings: 8, # EE-only
suggest_popover_dismissed: 9,
tabs_position_highlight: 10,
threat_monitoring_info: 11, # EE-only
account_recovery_regular_check: 12, # EE-only
webhooks_moved: 13,
service_templates_deprecated: 14,
admin_integrations_moved: 15,
web_ide_alert_dismissed: 16,
active_user_count_threshold: 18, # EE-only
buy_pipeline_minutes_notification_dot: 19, # EE-only
personal_access_token_expiry: 21, # EE-only
suggest_pipeline: 22,
customize_homepage: 23,
feature_flags_new_version: 24
}
validates :user, presence: true
validates :feature_name,
......
# frozen_string_literal: true
module EE
module Enums
module UserCallout
extend ActiveSupport::Concern
class_methods do
extend ::Gitlab::Utils::Override
# If you are going to add new items to this hash, check that you're not going
# to conflict with FOSS-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/concerns/enums/user_callout.rb
override :feature_names
def feature_names
super.merge(
gold_trial: 4,
geo_enable_hashed_storage: 5,
geo_migrate_hashed_storage: 6,
canary_deployment: 7,
gold_trial_billings: 8,
threat_monitoring_info: 11,
account_recovery_regular_check: 12,
active_user_count_threshold: 18,
buy_pipeline_minutes_notification_dot: 19
)
end
end
end
end
end
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