mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-06 02:48:04 +00:00
fix(api): handle orphaned shared_chat rows when unsharing
This commit is contained in:
parent
1a97751e37
commit
e4be4ef2e4
1 changed files with 4 additions and 4 deletions
|
|
@ -1388,11 +1388,11 @@ async def delete_shared_chat_by_id(
|
|||
if not chat:
|
||||
raise HTTPException(status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.ACCESS_PROHIBITED)
|
||||
|
||||
if not chat.share_id:
|
||||
return False
|
||||
|
||||
await SharedChats.delete_by_chat_id(id, db=db)
|
||||
await Chats.update_chat_share_id_by_id(id, None, db=db)
|
||||
|
||||
if chat.share_id:
|
||||
await Chats.update_chat_share_id_by_id(id, None, db=db)
|
||||
|
||||
await AccessGrants.set_access_grants('shared_chat', id, [], db=db)
|
||||
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue