feat(poc): Disable widget based on country (#6658)

This commit is contained in:
Pranav Raj S
2023-03-14 09:09:57 -07:00
committed by GitHub
parent e8a174f689
commit eb7070d946
8 changed files with 72 additions and 53 deletions

View File

@@ -5,6 +5,7 @@ class WidgetsController < ActionController::Base
before_action :set_global_config
before_action :set_web_widget
before_action :ensure_account_is_active
before_action :ensure_location_is_supported
before_action :set_token
before_action :set_contact
before_action :build_contact
@@ -54,6 +55,8 @@ class WidgetsController < ActionController::Base
render json: { error: 'Account is suspended' }, status: :unauthorized unless @web_widget.inbox.account.active?
end
def ensure_location_is_supported; end
def additional_attributes
if @web_widget.inbox.account.feature_enabled?('ip_lookup')
{ created_at_ip: request.remote_ip }
@@ -70,3 +73,5 @@ class WidgetsController < ActionController::Base
response.headers.delete('X-Frame-Options')
end
end
WidgetsController.prepend_mod_with('WidgetsController')