From 0b9c0ae3b46435ff9280163d23a210382d16a29c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 6 Oct 2021 01:17:26 +0200 Subject: [PATCH] fdsfds --- files/routes/votes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files/routes/votes.py b/files/routes/votes.py index b1e5a132e..aa76f21ce 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -173,8 +173,9 @@ def api_vote_poll(comment_id, v): else: abort(400) comment_id = int(comment_id) + comment = get_comment(comment_id) - existing = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id, comment_id=comment_id).first() + existing = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id, comment_id=comment.id).first() if existing and existing.vote_type == vote: return "", 204 @@ -182,7 +183,7 @@ def api_vote_poll(comment_id, v): existing.vote_type = new g.db.add(existing) else: - vote = CommentVote(user_id=v.id, vote_type=new, comment_id=comment_id) + vote = CommentVote(user_id=v.id, vote_type=new, comment_id=comment.id) g.db.add(vote) g.db.flush()