From 2c0023436fbff4e24f213c292fb5bee0bdd04c65 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 3 May 2023 17:22:21 +0300 Subject: [PATCH] fix 500 error when voting on wall polls --- files/routes/polls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/routes/polls.py b/files/routes/polls.py index 3390cae62..d35538bd1 100644 --- a/files/routes/polls.py +++ b/files/routes/polls.py @@ -69,7 +69,12 @@ def vote_option_comment(option_id, v): abort(404) option = g.db.get(CommentOption, option_id) if not option: abort(404) - sub = option.parent.post.sub + + if option.parent.parent_submission: + sub = option.parent.post.sub + else: + sub = None + if sub in {'furry','vampire','racist','femboy'} and not v.house.lower().startswith(sub): abort(403, f"You need to be a member of House {sub.capitalize()} to vote on polls in /h/{sub}")