Chatwoot/app/controllers/api/v1/widget/events_controller.rb
Sojan Jose d800b55ac6
Chore: Add display name to the user (#1067)
* Chore: Adding browser info to web widget triggered event

fixes: #970

* Chore: Rename nickname to display name

references: #972

* Chore: Change nickname in code

* chore: fix errors

* Chore: update nginx config

fixes: #1057

* Chore: Fix specs
2020-07-20 18:28:14 +05:30

22 lines
531 B
Ruby

class Api::V1::Widget::EventsController < Api::V1::Widget::BaseController
include Events::Types
def create
Rails.configuration.dispatcher.dispatch(permitted_params[:name], Time.zone.now, contact_inbox: @contact_inbox, event_info: event_info)
head :no_content
end
private
def event_info
{
widget_language: params[:locale],
browser_language: browser.accept_language.first&.code,
browser: browser_params
}
end
def permitted_params
params.permit(:name, :website_token)
end
end