feat: Add the ability for a super admin to define account limits (#3946)
Fixes: #3773
This commit is contained in:
@@ -77,6 +77,7 @@ class Account < ApplicationRecord
|
||||
|
||||
enum locale: LANGUAGES_CONFIG.map { |key, val| [val[:iso_639_1_code], key] }.to_h
|
||||
|
||||
before_validation :validate_limit_keys
|
||||
after_create_commit :notify_creation
|
||||
|
||||
def agents
|
||||
@@ -114,8 +115,8 @@ class Account < ApplicationRecord
|
||||
|
||||
def usage_limits
|
||||
{
|
||||
agents: ChatwootApp.max_limit,
|
||||
inboxes: ChatwootApp.max_limit
|
||||
agents: ChatwootApp.max_limit.to_i,
|
||||
inboxes: ChatwootApp.max_limit.to_i
|
||||
}
|
||||
end
|
||||
|
||||
@@ -132,4 +133,8 @@ class Account < ApplicationRecord
|
||||
trigger.name('camp_dpid_before_insert').after(:insert).for_each(:row) do
|
||||
"execute format('create sequence IF NOT EXISTS camp_dpid_seq_%s', NEW.id);"
|
||||
end
|
||||
|
||||
def validate_limit_keys
|
||||
# method overridden in enterprise module
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user