2021-09-15 00:09:30 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Users
|
|
|
|
class GroupCallout < ApplicationRecord
|
2021-12-10 18:14:42 +00:00
|
|
|
include Users::Calloutable
|
2021-09-15 00:09:30 +00:00
|
|
|
|
|
|
|
self.table_name = 'user_group_callouts'
|
|
|
|
|
|
|
|
belongs_to :group
|
|
|
|
|
|
|
|
enum feature_name: {
|
2022-02-04 18:17:50 +00:00
|
|
|
invite_members_banner: 1,
|
|
|
|
approaching_seat_count_threshold: 2 # EE-only
|
2021-09-15 00:09:30 +00: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
|