feat: Allow SaaS users to manage subscription within the dashboard (#5059)

This commit is contained in:
Pranav Raj S
2022-07-19 19:04:17 +05:30
committed by GitHub
parent 0cee42a9f9
commit 7fc0d166e8
33 changed files with 773 additions and 18 deletions

View File

@@ -1,13 +1,18 @@
module Enterprise::Account
def usage_limits
{
agents: get_limits(:agents).to_i,
agents: agent_limits,
inboxes: get_limits(:inboxes).to_i
}
end
private
def agent_limits
subscribed_quantity = custom_attributes['subscribed_quantity']
subscribed_quantity || get_limits(:agents)
end
def get_limits(limit_name)
config_name = "ACCOUNT_#{limit_name.to_s.upcase}_LIMIT"
self[:limits][limit_name.to_s] || GlobalConfig.get(config_name)[config_name] || ChatwootApp.max_limit