This commit is contained in:
parent
e2bcffdc4c
commit
d75f31072c
|
@ -3,7 +3,7 @@ from aiohttp import ClientSession
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
|
|
||||||
from models.member import ChatMember
|
from models.member import ChatMember
|
||||||
from services.core import get_author
|
from services.core import authors_by_user
|
||||||
|
|
||||||
from settings import AUTH_URL
|
from settings import AUTH_URL
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ def login_required(f):
|
||||||
user_id = await check_auth(req)
|
user_id = await check_auth(req)
|
||||||
if user_id:
|
if user_id:
|
||||||
context["user_id"] = user_id
|
context["user_id"] = user_id
|
||||||
author: ChatMember | None = await get_author(user_id)
|
author: ChatMember | None = authors_by_user.get(user_id)
|
||||||
if author:
|
if author:
|
||||||
context["author_id"] = author["id"]
|
context["author_id"] = author["id"]
|
||||||
return await f(*args, **kwargs)
|
return await f(*args, **kwargs)
|
||||||
|
|
|
@ -52,7 +52,3 @@ async def get_my_followed() -> List[ChatMember]:
|
||||||
}
|
}
|
||||||
|
|
||||||
return await _request_endpoint(query_name, gql) or []
|
return await _request_endpoint(query_name, gql) or []
|
||||||
|
|
||||||
|
|
||||||
async def get_author(user: str = ""):
|
|
||||||
return authors_by_user.get(user)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user