Class: Protege::ThreadsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Protege::ThreadsController
- Defined in:
- app/controllers/protege/threads_controller.rb
Overview
Manages email threads — the inbox list, individual thread views, and composing new conversations from the dashboard console.
Instance Method Summary collapse
-
#create ⇒ void
Compose and dispatch a new conversation through the
Gateway. -
#destroy ⇒ void
Delete a thread and all its messages.
-
#index ⇒ void
List the inbox threads.
-
#new ⇒ void
Render the compose form for a new conversation.
-
#show ⇒ void
Show a thread with its messages newest-first.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Compose and dispatch a new conversation through the Gateway. Serves POST /threads.
Uses the same host-facing seam application code would — Gateway.message — passing any uploaded
files straight through as attachments. Redirects to the thread created for the resulting message.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/protege/threads_controller.rb', line 37 def create persona = Persona.find(compose_params[:persona_id]) = Gateway.( to: persona.email_address, subject: compose_params[:subject], body: compose_params[:body], attachments: compose_params[:files] || [] ) redirect_to thread_path(.email_thread) end |
#destroy ⇒ void
This method returns an undefined value.
Delete a thread and all its messages. Serves DELETE /threads/:id.
53 54 55 56 57 |
# File 'app/controllers/protege/threads_controller.rb', line 53 def destroy @thread.destroy! redirect_to threads_path end |
#index ⇒ void
This method returns an undefined value.
List the inbox threads. Serves GET /threads.
12 13 14 |
# File 'app/controllers/protege/threads_controller.rb', line 12 def index @threads = EmailThread.for_inbox end |
#new ⇒ void
This method returns an undefined value.
Render the compose form for a new conversation. Serves GET /threads/new.
29 |
# File 'app/controllers/protege/threads_controller.rb', line 29 def new; end |
#show ⇒ void
This method returns an undefined value.
Show a thread with its messages newest-first. Serves GET /threads/:id.
Liveness (the agent's reasoning and tool use) streams into the introspection panel, so the thread view itself is static — no per-message processing indicator to compute here.
22 23 24 |
# File 'app/controllers/protege/threads_controller.rb', line 22 def show @messages = @thread..order(sent_at: :desc) end |