myChats-fix

This commit is contained in:
tonyrewin 2022-11-02 16:52:35 +03:00
parent 79f3be67e0
commit 9052872c87

View File

@ -134,6 +134,8 @@ async def get_chats_by_user(slug: str):
async def user_chats(_, info): async def user_chats(_, info):
user = info.context["request"].user user = info.context["request"].user
chats = await get_chats_by_user(user.slug) chats = await get_chats_by_user(user.slug)
if not chats:
chats = []
for c in chats: for c in chats:
c['messages'] = await load_messages(c['id']) c['messages'] = await load_messages(c['id'])
c['unread'] = await get_unread_counter(c['id'], user.slug) c['unread'] = await get_unread_counter(c['id'], user.slug)