Skip to content

Serve escalated.admin.chat.end from the agent UI session - #145

Merged
mpge merged 1 commit into
mainfrom
fix/chat-end-ui-route
Oct 23, 2026
Merged

mpge merged 1 commit into
mainfrom
fix/chat-end-ui-route

Conversation

@mpge

@mpge mpge commented Oct 23, 2026

Copy link
Copy Markdown
Member

End Chat on the agent ticket page (shared frontend PR #215) posts {} to route('escalated.admin.chat.end', chat_session_id) with the agent's browser session and X-CSRF-TOKEN.

  • No route by that name existed, and the only end-chat endpoint, POST /escalated/api/agent/chat/{sessionId}/end, is on the stateless token-auth API chain, which ignores the session cookie (verified by a test: a session-authenticated POST there is refused).
  • Adds POST /escalated/agent/chat/{session}/end on AgentUiController (agent gate, web chain CSRF, escalated.ui.enabled), reading no body: 200 {message:'Chat ended.'}, 422 {message:'Chat is already ended.'} like escalated-laravel, 404 for an unknown session.
  • Registers escalated.admin.chat.end -> /agent/chat/{session}/end in UiRoutes.
  • API endpoint unchanged (still 200 with the session body for API callers).

Tests: AgentChatEndUiTest through MockMvc with a session-stored security context and CSRF header: name resolves, ends the chat, 422, 404, no CSRF -> 403, non-agent -> 403, API endpoint refuses the browser session but still works for API callers. Full suite + checkstyle green locally on H2, PostgreSQL 17 and MySQL 8.4.

The shared TicketShow posts End Chat to route('escalated.admin.chat.end',
chat_session_id). The only end-chat endpoint was on the stateless
/escalated/api chain, which ignores the browser session, so the name did
not resolve and the page could not end a chat. Add POST
/escalated/agent/chat/{session}/end behind the agent gate and CSRF, 422
when already ended as escalated-laravel.
@mpge
mpge merged commit decbcda into main Oct 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant