chore: Allow super admin to suspend an account (#5174)

This commit is contained in:
Pranav Raj S
2022-08-03 11:40:03 +05:30
committed by GitHub
parent 4152883f38
commit e0cebfaa1a
20 changed files with 259 additions and 23 deletions
+5
View File
@@ -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 }