Class: Testimonials::EventsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Testimonials::EventsController
- Defined in:
- app/controllers/testimonials/events_controller.rb
Overview
The widget reports auto-prompt lifecycle here: "shown" when it opened itself, "dismissed" when the user closed it without submitting. ("submitted" is recorded server-side by the create endpoints.) These events feed PromptEvent.eligible?, which is what keeps auto-prompts from nagging anyone.
Constant Summary collapse
- CLIENT_ACTIONS =
%w[shown dismissed].freeze
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/testimonials/events_controller.rb', line 14 def create kind = params[:kind].to_s action = params[:event_action].to_s head :unprocessable_entity and return unless PromptEvent::KINDS.include?(kind) && CLIENT_ACTIONS.include?(action) PromptEvent.record!(kind: kind, action: action, tenant: current_tenant, author_id: , visitor_token: ensure_visitor_token) head :no_content end |