2021-11-11 11:23:49 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Users
|
|
|
|
class GroupCallout < ApplicationRecord
|
2022-01-26 12:08:38 +05:30
|
|
|
include Users::Calloutable
|
2021-11-11 11:23:49 +05:30
|
|
|
|
|
|
|
self.table_name = 'user_group_callouts'
|
|
|
|
|
|
|
|
belongs_to :group
|
|
|
|
|
|
|
|
enum feature_name: {
|
2022-04-04 11:22:00 +05:30
|
|
|
invite_members_banner: 1,
|
|
|
|
approaching_seat_count_threshold: 2, # EE-only
|
2023-07-09 08:55:56 +05:30
|
|
|
namespace_storage_pre_enforcement_banner: 3, # EE-only
|
|
|
|
# 4,5,6 were unused and removed with https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118330,
|
|
|
|
# they can be replaced.
|
2022-06-21 17:19:12 +05:30
|
|
|
preview_user_over_limit_free_plan_alert: 7, # EE-only
|
2022-08-13 15:12:31 +05:30
|
|
|
user_reached_limit_free_plan_alert: 8, # EE-only
|
2022-08-27 11:52:29 +05:30
|
|
|
free_group_limited_alert: 9, # EE-only
|
|
|
|
namespace_storage_limit_banner_info_threshold: 10, # EE-only
|
|
|
|
namespace_storage_limit_banner_warning_threshold: 11, # EE-only
|
|
|
|
namespace_storage_limit_banner_alert_threshold: 12, # EE-only
|
|
|
|
namespace_storage_limit_banner_error_threshold: 13, # EE-only
|
|
|
|
usage_quota_trial_alert: 14, # EE-only
|
2023-03-04 22:38:38 +05:30
|
|
|
preview_usage_quota_free_plan_alert: 15, # EE-only
|
2023-05-27 22:25:52 +05:30
|
|
|
enforcement_at_limit_alert: 16, # EE-only
|
|
|
|
web_hook_disabled: 17, # EE-only
|
|
|
|
unlimited_members_during_trial_alert: 18 # EE-only
|
2021-11-11 11:23:49 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
validates :group, presence: true
|
|
|
|
validates :feature_name,
|
2023-07-09 08:55:56 +05:30
|
|
|
presence: true,
|
|
|
|
uniqueness: { scope: [:user_id, :group_id] },
|
|
|
|
inclusion: { in: GroupCallout.feature_names.keys }
|
2021-11-11 11:23:49 +05:30
|
|
|
|
|
|
|
def source_feature_name
|
|
|
|
"#{feature_name}_#{group_id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|