feat: Allow SaaS users to manage subscription within the dashboard (#5059)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user