mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
fix(chat): allow administrator to delete channel-only sessions
Align administrator session deletion with the administrator chat view so sessions surfaced through channel_session_v2 can be removed without a ui_session_owner row. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4f36f4a36f
commit
e3828418d4
5 changed files with 93 additions and 4 deletions
|
|
@ -984,8 +984,10 @@ def include_chat_routes(router: APIRouter, *, resolve_auth: Callable[[SqliteStor
|
|||
if not sess:
|
||||
raise HTTPException(status_code=404, detail="session_not_found")
|
||||
if _is_administrator_chat_viewer(ctx):
|
||||
deleted = store.delete_session_for_administrator_username(
|
||||
session_id=session_id, username=_chat_username(ctx)
|
||||
deleted = store.delete_session_for_administrator_chat_view(
|
||||
session_id=session_id,
|
||||
username=_chat_username(ctx),
|
||||
tenant_id=tenant_id,
|
||||
)
|
||||
else:
|
||||
deleted = store.delete_session_for_user(
|
||||
|
|
@ -994,8 +996,11 @@ def include_chat_routes(router: APIRouter, *, resolve_auth: Callable[[SqliteStor
|
|||
if not deleted:
|
||||
raise HTTPException(status_code=404, detail="session_not_found")
|
||||
if _is_administrator_chat_viewer(ctx):
|
||||
remaining = store.list_sessions_for_administrator_username(
|
||||
username=_chat_username(ctx), limit=1, offset=0
|
||||
remaining = store.list_sessions_for_administrator_chat_view(
|
||||
username=_chat_username(ctx),
|
||||
tenant_id=tenant_id,
|
||||
limit=1,
|
||||
offset=0,
|
||||
)
|
||||
else:
|
||||
remaining = store.list_sessions_for_user(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue