Commit 607fa30c authored by Vitali Tatarintev's avatar Vitali Tatarintev

Move UserCalloutEnums to Enums::UserCallout

Move enums related modules into a separate directory.
parent cb5d8229
# 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,
admin_integrations_moved: 15,
personal_access_token_expiry: 21 # EE-only
}
end
end
end
Enums::UserCallout.prepend_if_ee('EE::Enums::UserCallout')
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
class UserCallout < ApplicationRecord class UserCallout < ApplicationRecord
belongs_to :user belongs_to :user
# We use `UserCalloutEnums.feature_names` here so that EE can more easily # We use `Enums::UserCallout.feature_names` here so that EE can more easily
# extend this `Hash` with new values. # extend this `Hash` with new values.
enum feature_name: ::UserCalloutEnums.feature_names enum feature_name: Enums::UserCallout.feature_names
validates :user, presence: true validates :user, presence: true
validates :feature_name, validates :feature_name,
......
# frozen_string_literal: true
module UserCalloutEnums
# 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/ee/user_callout_enums.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,
admin_integrations_moved: 15,
personal_access_token_expiry: 21 # EE-only
}
end
end
UserCalloutEnums.prepend_if_ee('EE::UserCalloutEnums')
...@@ -13,7 +13,7 @@ class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0] ...@@ -13,7 +13,7 @@ class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0]
BATCH_SIZE = 1_000 BATCH_SIZE = 1_000
# Inlined from UserCalloutEnums.feature_names # Inlined from Enums::UserCallout.feature_names
FEATURE_NAME_ALERTS_MOVED = 20 FEATURE_NAME_ALERTS_MOVED = 20
def up def up
......
# 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,
users_over_license_banner: 16,
standalone_vulnerabilities_introduction_banner: 17,
active_user_count_threshold: 18,
buy_pipeline_minutes_notification_dot: 19
)
end
end
end
end
end
# frozen_string_literal: true
module EE
module UserCalloutEnums
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/user_callout_enums.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,
users_over_license_banner: 16,
standalone_vulnerabilities_introduction_banner: 17,
active_user_count_threshold: 18,
buy_pipeline_minutes_notification_dot: 19
)
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