fix: force build_contact and increment_view_count methods to use writing role
These methods are used by the widget to create a contact and helpcenter to increment the view count. Since these methods are triggered by GET request, Rails will use the reading role which will fail if the table is readonly.
This commit is contained in:
@@ -47,8 +47,10 @@ class WidgetsController < ActionController::Base
|
||||
def build_contact
|
||||
return if @contact.present?
|
||||
|
||||
@contact_inbox, @token = build_contact_inbox_with_token(@web_widget, additional_attributes)
|
||||
@contact = @contact_inbox.contact
|
||||
ActiveRecord::Base.connected_to(role: :writing) do
|
||||
@contact_inbox, @token = build_contact_inbox_with_token(@web_widget, additional_attributes)
|
||||
@contact = @contact_inbox.contact
|
||||
end
|
||||
end
|
||||
|
||||
def ensure_account_is_active
|
||||
|
||||
Reference in New Issue
Block a user