mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 21:42:58 +00:00
fix: cascade shared chat delete
This commit is contained in:
parent
10cad60566
commit
a0d932b986
@ -230,10 +230,13 @@ class ChatTable:
|
|||||||
|
|
||||||
def delete_chats_by_user_id(self, user_id: str) -> bool:
|
def delete_chats_by_user_id(self, user_id: str) -> bool:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
self.delete_shared_chats_by_user_id(user_id)
|
||||||
|
|
||||||
query = Chat.delete().where(Chat.user_id == user_id)
|
query = Chat.delete().where(Chat.user_id == user_id)
|
||||||
query.execute() # Remove the rows, return number of rows removed.
|
query.execute() # Remove the rows, return number of rows removed.
|
||||||
|
|
||||||
return True and self.delete_shared_chats_by_user_id(user_id)
|
return True
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -244,6 +247,8 @@ class ChatTable:
|
|||||||
for chat in Chat.select().where(Chat.user_id == user_id)
|
for chat in Chat.select().where(Chat.user_id == user_id)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
print(shared_chat_ids)
|
||||||
|
|
||||||
query = Chat.delete().where(Chat.user_id << shared_chat_ids)
|
query = Chat.delete().where(Chat.user_id << shared_chat_ids)
|
||||||
query.execute() # Remove the rows, return number of rows removed.
|
query.execute() # Remove the rows, return number of rows removed.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user