mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
feat: Fetching the portal data related to a specific custom domain (#5249)
This commit is contained in:
@@ -4,6 +4,7 @@ class DashboardController < ActionController::Base
|
||||
before_action :set_global_config
|
||||
around_action :switch_locale
|
||||
before_action :ensure_installation_onboarding, only: [:index]
|
||||
before_action :redirect_to_custom_domain_page
|
||||
|
||||
layout 'vueapp'
|
||||
|
||||
@@ -37,6 +38,15 @@ class DashboardController < ActionController::Base
|
||||
redirect_to '/installation/onboarding' if ::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)
|
||||
end
|
||||
|
||||
def redirect_to_custom_domain_page
|
||||
custom_domain = request.host
|
||||
portal = Portal.find_by(custom_domain: custom_domain)
|
||||
|
||||
return unless portal
|
||||
|
||||
redirect_to "/hc/#{portal.slug}"
|
||||
end
|
||||
|
||||
def app_config
|
||||
{
|
||||
APP_VERSION: Chatwoot.config[:version],
|
||||
|
||||
Reference in New Issue
Block a user