some-fixes-graphql
This commit is contained in:
parent
f6ef50f878
commit
405dbb49cf
|
@ -51,7 +51,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0):
|
|||
members_online = (await redis.execute("SMEMBERS", "authors-online")) or []
|
||||
chats = []
|
||||
if len(cids) == 0:
|
||||
print("[resolvers.load] no chats for user {}, create one with Discours (id=2)")
|
||||
print(f"[resolvers.load] no chats for user with id={author_id}, create one with Discours (id=2)")
|
||||
r = await create_chat(None, info, members=[2]) # member with id = 1 is discours
|
||||
cids.append(r["chat"]["id"])
|
||||
for cid in cids:
|
||||
|
|
|
@ -32,13 +32,17 @@ async def check_auth(req):
|
|||
if response.status_code != 200:
|
||||
return False, None
|
||||
r = response.json()
|
||||
user_id = (
|
||||
r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
|
||||
if INTERNAL_AUTH_SERVER
|
||||
else r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
|
||||
)
|
||||
is_authenticated = user_id is not None
|
||||
return is_authenticated, user_id
|
||||
try:
|
||||
user_id = (
|
||||
r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
|
||||
if INTERNAL_AUTH_SERVER
|
||||
else r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
|
||||
)
|
||||
is_authenticated = user_id is not None
|
||||
return is_authenticated, user_id
|
||||
except Exception as e:
|
||||
print(f"response contains no proper data: {r}")
|
||||
return False, None
|
||||
|
||||
|
||||
def login_required(f):
|
||||
|
|
Loading…
Reference in New Issue
Block a user