mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd): reject pinning child chats in patchChat handler (#24669)
The UI already prevents child (delegated/subagent) chats from being
pinned, but the `PATCH /api/experimental/chats/{chat}` endpoint did not
enforce this. A direct API call could pin a child chat.
- Add a `400 Bad Request` guard in `patchChat` when `pinOrder > 0` and
the chat has a `ParentChatID`
- Add `TestChatPinOrder/RejectsChildChat` test
> 🤖
This commit is contained in:
Generated
+3
-1
@@ -1483,7 +1483,9 @@ CREATE TABLE chats (
|
||||
dynamic_tools jsonb,
|
||||
organization_id uuid NOT NULL,
|
||||
plan_mode chat_plan_mode,
|
||||
client_type chat_client_type DEFAULT 'api'::chat_client_type NOT NULL
|
||||
client_type chat_client_type DEFAULT 'api'::chat_client_type NOT NULL,
|
||||
CONSTRAINT chats_pin_order_archived_check CHECK (((pin_order = 0) OR (archived = false))),
|
||||
CONSTRAINT chats_pin_order_parent_check CHECK (((pin_order = 0) OR (parent_chat_id IS NULL)))
|
||||
);
|
||||
|
||||
CREATE TABLE connection_logs (
|
||||
|
||||
Reference in New Issue
Block a user