This commit is contained in:
@@ -4,7 +4,7 @@ from typing import Any, Dict, List, Union
|
||||
|
||||
from resolvers.load import load_messages
|
||||
from services.auth import login_required
|
||||
from services.core import authors_by_id, authors_by_user
|
||||
from services.core import authors_by_id
|
||||
from services.rediscache import redis
|
||||
from services.schema import query
|
||||
|
||||
@@ -16,9 +16,7 @@ async def search_recipients(_, info, text: str, limit: int = 50, offset: int = 0
|
||||
|
||||
# TODO: maybe redis scan?
|
||||
|
||||
user_id = info.context["user_id"]
|
||||
author = authors_by_user[user_id]
|
||||
author_id = author["id"]
|
||||
author_id = info.context["author_id"]
|
||||
|
||||
existed_chats = await redis.execute("SMEMBERS", f"/chats_by_author/{author_id}")
|
||||
if existed_chats:
|
||||
@@ -41,9 +39,7 @@ async def search_recipients(_, info, text: str, limit: int = 50, offset: int = 0
|
||||
async def search_messages(
|
||||
_, info, by: Dict[str, Union[str, int]], limit: int, offset: int
|
||||
) -> Dict[str, Union[List[Dict[str, Any]], None]]:
|
||||
user_id = info.context["user_id"]
|
||||
author = authors_by_user[user_id]
|
||||
author_id = author["id"]
|
||||
author_id = info.context["author_id"]
|
||||
lookup_chats = set((await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")) or [])
|
||||
messages_set = set([])
|
||||
|
||||
|
Reference in New Issue
Block a user