2021-09-14 20:09:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Users
|
|
|
|
class GroupCallout < ApplicationRecord
|
2021-12-10 13:14:42 -05:00
|
|
|
include Users::Calloutable
|
2021-09-14 20:09:30 -04:00
|
|
|
|
|
|
|
self.table_name = 'user_group_callouts'
|
|
|
|
|
|
|
|
belongs_to :group
|
|
|
|
|
|
|
|
enum feature_name: {
|
2022-02-04 13:17:50 -05:00
|
|
|
invite_members_banner: 1,
|
2022-02-15 16:12:52 -05:00
|
|
|
approaching_seat_count_threshold: 2, # EE-only
|
2022-03-11 07:07:56 -05:00
|
|
|
storage_enforcement_banner_first_enforcement_threshold: 3,
|
|
|
|
storage_enforcement_banner_second_enforcement_threshold: 4,
|
|
|
|
storage_enforcement_banner_third_enforcement_threshold: 5,
|
2022-03-30 17:09:29 -04:00
|
|
|
storage_enforcement_banner_fourth_enforcement_threshold: 6,
|
|
|
|
preview_user_over_limit_free_plan_alert: 7 # EE-only
|
2021-09-14 20:09:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
validates :group, presence: true
|
|
|
|
validates :feature_name,
|
|
|
|
presence: true,
|
|
|
|
uniqueness: { scope: [:user_id, :group_id] },
|
|
|
|
inclusion: { in: GroupCallout.feature_names.keys }
|
|
|
|
|
|
|
|
def source_feature_name
|
|
|
|
"#{feature_name}_#{group_id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|