From a6c23300b55bf507269b5450a26c6634f0699b3e Mon Sep 17 00:00:00 2001 From: Ben Rog-Wilhelm Date: Mon, 26 Jun 2023 17:40:14 -0500 Subject: [PATCH] Fix: Comparing with truthiness when None-comparison is intended. --- files/routes/admin/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/admin/admin.py b/files/routes/admin/admin.py index 001ebb121..88c7fc6e8 100644 --- a/files/routes/admin/admin.py +++ b/files/routes/admin/admin.py @@ -296,7 +296,7 @@ def update_filter_status(v): old_status = target.state_mod # this could totally be one query but it would be kinda ugly - if state_mod_new: + if state_mod_new is not None: g.db.query(Submission).where(Submission.id == post_id) \ .update({Submission.state_mod: state_mod_new, Submission.state_mod_set_by: v.username}) g.db.query(Submission).where(Submission.id == post_id) \ @@ -305,7 +305,7 @@ def update_filter_status(v): target = g.db.get(Comment, comment_id) old_status = target.state_mod - if state_mod_new: + if state_mod_new is not None: g.db.query(Comment).where(Comment.id == comment_id) \ .update({Comment.state_mod: state_mod_new, Comment.state_mod_set_by: v.username}) g.db.query(Comment).where(Comment.id == comment_id) \