This commit is contained in:
@@ -6,7 +6,7 @@ from models.chat import ChatPayload, Message
|
||||
from models.member import ChatMember
|
||||
from resolvers.chats import create_chat
|
||||
from services.auth import login_required
|
||||
from services.core import authors_by_id, get_my_followed, authors_by_user
|
||||
from services.core import authors_by_id, get_my_followed
|
||||
from services.rediscache import redis
|
||||
from services.schema import query
|
||||
|
||||
@@ -52,9 +52,7 @@ async def load_messages(
|
||||
@login_required
|
||||
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"""
|
||||
user_id = info.context["user_id"]
|
||||
author = authors_by_user[user_id]
|
||||
author_id = author["id"]
|
||||
author_id = info.context["author_id"]
|
||||
chats = []
|
||||
if author_id:
|
||||
cids = await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")
|
||||
@@ -90,9 +88,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
|
||||
@login_required
|
||||
async def load_messages_by(_, info, by, limit: int = 10, offset: int = 0):
|
||||
"""load :limit messages of :chat_id with :offset"""
|
||||
user_id = info.context["user_id"]
|
||||
author = authors_by_user[user_id]
|
||||
author_id = author["id"]
|
||||
author_id = info.context["author_id"]
|
||||
author_chats = (await redis.execute("SMEMBERS", "chats_by_author/" + str(author_id))) or []
|
||||
author_chats = [c for c in author_chats]
|
||||
if author_chats:
|
||||
|
Reference in New Issue
Block a user