chats-authors-fix
All checks were successful
deploy / deploy (push) Successful in 1m23s

This commit is contained in:
Untone 2023-11-14 22:12:39 +03:00
parent cfe3c8a748
commit 6547cea970

View File

@ -65,6 +65,8 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
r = await create_chat(None, info, members=[2]) # member with id = 2 is discours
print(f"[resolvers.load] created chat: {r['chat']}")
cids.append(r["chat"]["id"])
all_authors: List[ChatMember] = await get_all_authors()
authors = {a["id"]: a for a in all_authors}
for cid in cids:
async with lock:
chat_str = await redis.execute("GET", f"chats/{cid}")
@ -76,7 +78,8 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
member_ids = c["members"].copy()
c["members"] = []
for member_id in member_ids:
for a in await get_my_followings():
a = authors.get(member_id)
if a:
a["online"] = a.get("id") in members_online
c["members"].append(a)
chats.append(c)