Class: Silas::Inbox::InvocationsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/silas/inbox/invocations_controller.rb

Overview

Approve/decline from the UI — the SAME code path as the Slack buttons and email links (invocation.approve!/decline!). Writes always require real auth, even when reads are public.

Instance Method Summary collapse

Instance Method Details

#approveObject



10
11
12
13
14
15
# File 'app/controllers/silas/inbox/invocations_controller.rb', line 10

def approve
  @invocation.approve!(by: current_actor)
  respond_resolved
rescue Silas::Error => e
  respond_error(e)
end

#declineObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/silas/inbox/invocations_controller.rb', line 17

def decline
  # decline-with-note: the textarea's reason becomes {denied: reason},
  # which the model sees as the tool result.
  reason = params[:reason].presence || "declined from inbox"
  @invocation.decline!(reason: reason, by: current_actor)
  respond_resolved
rescue Silas::Error => e
  respond_error(e)
end