chore: Allow super admin to suspend an account (#5174)
This commit is contained in:
@@ -4,6 +4,7 @@ class WidgetsController < ActionController::Base
|
||||
|
||||
before_action :set_global_config
|
||||
before_action :set_web_widget
|
||||
before_action :ensure_account_is_active
|
||||
before_action :set_token
|
||||
before_action :set_contact
|
||||
before_action :build_contact
|
||||
@@ -46,6 +47,10 @@ class WidgetsController < ActionController::Base
|
||||
@contact = @contact_inbox.contact
|
||||
end
|
||||
|
||||
def ensure_account_is_active
|
||||
render json: { error: 'Account is suspended' }, status: :unauthorized unless @web_widget.inbox.account.active?
|
||||
end
|
||||
|
||||
def additional_attributes
|
||||
if @web_widget.inbox.account.feature_enabled?('ip_lookup')
|
||||
{ created_at_ip: request.remote_ip }
|
||||
|
||||
Reference in New Issue
Block a user