Skip to content

Commit

Permalink
Prevent NotInAppUsers exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Jan 9, 2025
1 parent 01e982a commit e88badb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/puzzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,14 @@ async def puzzle_vote(request):
good = post_data["vote"] == "true"
up_or_down = "up" if good else "down"

users = app_state.users
# Who made the request?
session = await aiohttp_session.get_session(request)
try:
user = users[session.get("user_name")]
except KeyError:
session_user = session.get("user_name")
if session_user is None:
return web.json_response({})

user = await app_state.users.get(session_user)

if user.puzzles.get("puzzleId"):
return web.json_response({})
else:
Expand Down

0 comments on commit e88badb

Please sign in to comment.