2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
class UserCallout < ApplicationRecord
|
2018-03-17 18:26:18 +05:30
|
|
|
belongs_to :user
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
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
|
|
|
|
}
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
validates :user, presence: true
|
|
|
|
validates :feature_name,
|
|
|
|
presence: true,
|
|
|
|
uniqueness: { scope: :user_id },
|
|
|
|
inclusion: { in: UserCallout.feature_names.keys }
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
scope :with_feature_name, -> (feature_name) { where(feature_name: UserCallout.feature_names[feature_name]) }
|
|
|
|
scope :with_dismissed_after, -> (dismissed_after) { where('dismissed_at > ?', dismissed_after) }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|