Class: Protege::RepliesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Protege::RepliesController
- Includes:
- ThreadScoped
- Defined in:
- app/controllers/protege/replies_controller.rb
Overview
Handles replies within an existing thread from the dashboard
console. Nested under threads via the ThreadScoped concern, which loads
@thread from params[:thread_id].
Instance Method Summary collapse
-
#create ⇒ void
Build a reply mail and hand it to the
Gatewayfor inbound processing.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Build a reply mail and hand it to the Gateway for inbound processing.
Serves POST /threads/:thread_id/reply.
The console acts as the sender; the reply is addressed to the thread's persona so the LOGI loop processes it as if it arrived over SMTP.
The new message inserts itself into the thread over Turbo (its after_create_commit broadcast,
see BroadcastableMessage), so a Turbo request needs no body — it just returns 201 Created, which
Turbo treats as "handled, no navigation". Skipping the redirect keeps the live introspection panel
intact, so a new run appends below the prior ones instead of resetting. Non-Turbo clients redirect.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/protege/replies_controller.rb', line 22 def create Gateway.( mail: build_reply_mail, persona: @thread.persona, attachments: reply_params[:files] || [] ) respond_to do |format| format.turbo_stream { head :created } format.html { redirect_to thread_path(@thread) } end end |