feat: Add the ability for a super admin to define account limits (#3946)

Fixes: #3773
This commit is contained in:
Sojan Jose
2022-02-14 15:55:08 +05:30
committed by GitHub
parent edd93ca4a3
commit 3d73d8935a
9 changed files with 71 additions and 14 deletions

View File

@@ -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