This commit is contained in:
parent
cfe3c8a748
commit
6547cea970
|
@ -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
|
r = await create_chat(None, info, members=[2]) # member with id = 2 is discours
|
||||||
print(f"[resolvers.load] created chat: {r['chat']}")
|
print(f"[resolvers.load] created chat: {r['chat']}")
|
||||||
cids.append(r["chat"]["id"])
|
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:
|
for cid in cids:
|
||||||
async with lock:
|
async with lock:
|
||||||
chat_str = await redis.execute("GET", f"chats/{cid}")
|
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()
|
member_ids = c["members"].copy()
|
||||||
c["members"] = []
|
c["members"] = []
|
||||||
for member_id in member_ids:
|
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
|
a["online"] = a.get("id") in members_online
|
||||||
c["members"].append(a)
|
c["members"].append(a)
|
||||||
chats.append(c)
|
chats.append(c)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user