unread-counter-fix
All checks were successful
deploy / deploy (push) Successful in 1m14s

This commit is contained in:
Untone 2023-12-18 03:15:59 +03:00
parent 5c0621dc9b
commit 6023cfb4c2
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class ChatPayload(TypedDict):
created_by: int created_by: int
description: Optional[str] description: Optional[str]
messages: Optional[List[Message]] messages: Optional[List[Message]]
unread: Optional[List[int]] unread: Optional[int] # counter
class ChatUpdate(TypedDict): class ChatUpdate(TypedDict):

View File

@ -34,7 +34,7 @@ async def load_messages(
replies = [] replies = []
for m in messages: for m in messages:
if m: if m:
reply_to = m.get("replyTo") reply_to = m.get("reply_to")
if reply_to: if reply_to:
reply_to = int(reply_to) reply_to = int(reply_to)
if reply_to not in message_ids: if reply_to not in message_ids:
@ -60,7 +60,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
lock = asyncio.Lock() lock = asyncio.Lock()
if len(cids) == 0: if len(cids) == 0:
print(f"[resolvers.load] no chats for user with id={author_id}") print(f"[resolvers.load] no chats for user with id={author_id}")
r = await create_chat(None, info, members=[2]) # member with id = 2 is discours r = await create_chat(None, info, members=[1]) # member with id = 1 is discours
print(f"[resolvers.load] created chat: {r['chat_id']}") print(f"[resolvers.load] created chat: {r['chat_id']}")
cids.append(r["chat"]["id"]) cids.append(r["chat"]["id"])
all_authors: List[ChatMember] = await get_all_authors() all_authors: List[ChatMember] = await get_all_authors()