chore: Prevent i18n config bleeding across requests (#1214)
This commit is contained in:
@@ -15,7 +15,6 @@ class Api::V1::Accounts::BaseController < Api::BaseController
|
||||
elsif @resource&.is_a?(AgentBot)
|
||||
account_accessible_for_bot?(account)
|
||||
end
|
||||
switch_locale account
|
||||
account
|
||||
end
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ class Api::V1::Widget::BaseController < ApplicationController
|
||||
|
||||
def set_web_widget
|
||||
@web_widget = ::Channel::WebWidget.find_by!(website_token: permitted_params[:website_token])
|
||||
@account = @web_widget.account
|
||||
switch_locale @account
|
||||
@current_account = @web_widget.account
|
||||
end
|
||||
|
||||
def set_contact
|
||||
|
||||
@@ -20,7 +20,7 @@ class Api::V1::Widget::LabelsController < Api::V1::Widget::BaseController
|
||||
private
|
||||
|
||||
def label_defined_in_account?
|
||||
label = @account.labels.find_by(title: permitted_params[:label])
|
||||
label = @current_account.labels&.find_by(title: permitted_params[:label])
|
||||
label.present?
|
||||
end
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ class Api::V1::Widget::MessagesController < Api::V1::Widget::BaseController
|
||||
end
|
||||
|
||||
def update_contact(email)
|
||||
contact_with_email = @account.contacts.find_by(email: email)
|
||||
contact_with_email = @current_account.contacts.find_by(email: email)
|
||||
if contact_with_email
|
||||
@contact = ::ContactMergeAction.new(
|
||||
account: @account,
|
||||
account: @current_account,
|
||||
base_contact: contact_with_email,
|
||||
mergee_contact: @contact
|
||||
).perform
|
||||
|
||||
Reference in New Issue
Block a user