delete_chat fixed
This commit is contained in:
parent
c495c64443
commit
e58b5eb0a1
|
@ -92,11 +92,11 @@ async def create_chat(_, info, title="", members=None):
|
||||||
async def delete_chat(_, info, chat_id: str):
|
async def delete_chat(_, info, chat_id: str):
|
||||||
author_id = info.context["author_id"]
|
author_id = info.context["author_id"]
|
||||||
|
|
||||||
chat_str = await redis.execute("GET", f"/chats/{chat_id}")
|
chat_str = await redis.execute("GET", f"chats/{chat_id}")
|
||||||
if chat_str:
|
if chat_str:
|
||||||
chat: Chat = json.loads(chat_str)
|
chat: Chat = json.loads(chat_str)
|
||||||
if author_id in chat["admins"]:
|
if author_id in chat["admins"]:
|
||||||
await redis.execute("DEL", f"chats/{chat_id}")
|
await redis.execute("DEL", f"chats/{chat_id}")
|
||||||
await redis.execute("SREM", f"chats_by_author/{author_id}", chat_id)
|
await redis.execute("SREM", f"chats_by_author/{author_id}", chat_id)
|
||||||
else:
|
else:
|
||||||
return {"error": "chat not exist"}
|
return {"error": "chat not exist"}
|
Loading…
Reference in New Issue
Block a user