mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 02:32:29 +00:00 
			
		
		
		
	feat: Add the ability for a super admin to define account limits (#3946)
Fixes: #3773
This commit is contained in:
		| @@ -2,6 +2,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController | ||||
|   include Api::V1::InboxesHelper | ||||
|   before_action :fetch_inbox, except: [:index, :create] | ||||
|   before_action :fetch_agent_bot, only: [:set_agent_bot] | ||||
|   before_action :validate_limit, only: [:create] | ||||
|   # we are already handling the authorization in fetch inbox | ||||
|   before_action :check_authorization, except: [:show] | ||||
|  | ||||
| @@ -143,4 +144,10 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController | ||||
|       [] | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   def validate_limit | ||||
|     return unless Current.account.inboxes.count >= Current.account.usage_limits[:inboxes] | ||||
|  | ||||
|     render_payment_required('Account limit exceeded. Upgrade to a higher plan') | ||||
|   end | ||||
| end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sojan Jose
					Sojan Jose