loadchats-fix
This commit is contained in:
parent
e9b2e55502
commit
77729b30bc
|
@ -25,7 +25,6 @@ async def update_chat(_, info, chat_new):
|
||||||
return {"error": "chat not exist"}
|
return {"error": "chat not exist"}
|
||||||
chat = dict(json.loads(chat))
|
chat = dict(json.loads(chat))
|
||||||
|
|
||||||
# TODO
|
|
||||||
if author_id in chat["admins"]:
|
if author_id in chat["admins"]:
|
||||||
chat.update(
|
chat.update(
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,9 +45,8 @@ async def load_messages(chat_id: str, limit: int = 5, offset: int = 0, ids=None)
|
||||||
async def load_chats(_, info, limit: int = 50, offset: int = 0):
|
async def load_chats(_, info, limit: int = 50, offset: int = 0):
|
||||||
"""load :limit chats of current user with :offset"""
|
"""load :limit chats of current user with :offset"""
|
||||||
author_id = info.context["author_id"]
|
author_id = info.context["author_id"]
|
||||||
cids = list(
|
cids = (await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")) or []
|
||||||
(await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")) or []
|
cids = cids[offset:(offset + limit)]
|
||||||
)[offset:(offset + limit)]
|
|
||||||
members_online = (await redis.execute("SMEMBERS", "authors-online")) or []
|
members_online = (await redis.execute("SMEMBERS", "authors-online")) or []
|
||||||
chats = []
|
chats = []
|
||||||
if len(cids) == 0:
|
if len(cids) == 0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user