mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			576 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			576 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
class Public::Api::V1::PortalsController < Public::Api::V1::Portals::BaseController
 | 
						|
  before_action :ensure_custom_domain_request, only: [:show]
 | 
						|
  before_action :portal
 | 
						|
  before_action :redirect_to_portal_with_locale, only: [:show]
 | 
						|
  layout 'portal'
 | 
						|
 | 
						|
  def show; end
 | 
						|
 | 
						|
  private
 | 
						|
 | 
						|
  def portal
 | 
						|
    @portal ||= Portal.find_by!(slug: params[:slug], archived: false)
 | 
						|
    @locale = params[:locale] || @portal.default_locale
 | 
						|
  end
 | 
						|
 | 
						|
  def redirect_to_portal_with_locale
 | 
						|
    return if params[:locale].present?
 | 
						|
 | 
						|
    redirect_to "/hc/#{@portal.slug}/#{@portal.default_locale}"
 | 
						|
  end
 | 
						|
end
 |