loadchats-fix
All checks were successful
deploy / deploy (push) Successful in 1m6s

This commit is contained in:
Untone 2023-12-18 22:33:40 +03:00
parent 9d1a4e90c9
commit b2040099a8

View File

@ -53,9 +53,9 @@ async def load_messages(
async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Union[List[Dict[str, Any]], None]]:
"""load :limit chats of current user with :offset"""
author_id = info.context.get("author_id")
chats = []
if author_id:
cids = await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")
chats = []
if cids:
members_online = (await redis.execute("SMEMBERS", "authors-online")) or []
cids = list(cids)[offset : (offset + limit)]