From b1b7bf4dc23c581d704857801fad332bde6e5728 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 18 Dec 2023 10:05:48 +0300 Subject: [PATCH] context-fix --- services/auth.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/auth.py b/services/auth.py index 305edfe..a0bdde9 100644 --- a/services/auth.py +++ b/services/auth.py @@ -3,6 +3,7 @@ from functools import wraps import aiohttp from aiohttp.web import HTTPUnauthorized +from models.member import ChatMember from services.core import get_author from settings import AUTH_URL @@ -65,7 +66,9 @@ def login_required(f): raise HTTPUnauthorized(text="Please, login first") else: # Добавляем author_id и user_id в контекст - context["author_id"] = await get_author(user_id) + author: ChatMember | None = await get_author(user_id) + if author: + context["author_id"] = author["id"] context["user_id"] = user_id # Если пользователь аутентифицирован, выполняем резолвер