Repository navigation
Route the ticket page's End Chat button to a working endpoint - #220
Merged
Merged
Conversation
Add POST support/admin/chat/{session}/end, named escalated.admin.chat.end,
which the agent ticket page posts {} to from the agent's signed-in session.
It answers 422 for an already-ended chat, as escalated-laravel does, and
follows Escalated:RoutePrefix. The agent chat API route is unchanged.
This was referenced Oct 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The agent ticket page (escalated PR #215) resolves
route('escalated.admin.chat.end', ticket.chat_session_id)and, when it resolves, posts{}as JSON there on End Chat. This backend had no such name, so the button did nothing.What changed
POST support/admin/chat/{session}/end(AdminChatPageController), staff only (theescalated-agentpolicy, as the existing agent chat API). Ends the chat and resolves its ticket throughChatSessionService.EndAsync. Answers200 {message: "Chat ended."},422 {message: "Chat is already ended."}(escalated-laravel's response),404for an unknown session.escalated.admin.chat.end->{prefix}/admin/chat/{session}/endinUiRoutes.Defaults(Laravel's path).Escalated:RoutePrefixthrough a small MVC convention ([EscalatedPrefixedRoute]) that only touches controllers that opt in; every other controller keeps its hardcodedsupport/...route.POST support/agent/chat/{sessionId}/endis untouched (still400when already ended).Auth and CSRF
The UI and the API share the host's authentication; the policy reads
HttpContext.User, so the agent's browser session authorizes the post. No Escalated write (including the UI ticket form posts) validates antiforgery tokens, so theX-CSRF-TOKENheader the page sends is accepted and not required, matching the other UI writes.Tests
ChatEndRouteTestsruns through the real pipeline: reads the route map off the agent ticket page's HTML, posts{}with the page's headers, checks the session ended and the ticket resolved, the 422 on a second post, ahelpdeskprefix, 401/403/404, and that the old agent API still ends chats with its own responses. Full suite green on SQLite and PostgreSQL 17 (1029 tests);dotnet format --verify-no-changesclean.