From 984eff347698e3846fa93d3e49cb565384ce13d2 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 3 Nov 2022 03:33:37 -0500 Subject: [PATCH] user lists: don't show shadowbanned users on grassed and agendaposter page to people who can't see them --- files/routes/users.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index d0369f02f..84354ddf8 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -167,13 +167,19 @@ def user_upvoted_comments(v, username): @app.get("/grassed") @auth_required def grassed(v): - users = g.db.query(User).filter(User.ban_reason.like('grass award used by @%')).all() + users = g.db.query(User).filter(User.ban_reason.like('grass award used by @%')) + if not v.can_see_shadowbanned: + users = users.filter(User.shadowbanned == None) + users = users.all() return render_template("grassed.html", v=v, users=users) @app.get("/chuds") @auth_required def chuds(v): - users = g.db.query(User).filter(User.agendaposter > 0).order_by(User.username).all() + users = g.db.query(User).filter(User.agendaposter > 0) + if not v.can_see_shadowbanned: + users = users.filter(User.shadowbanned == None) + users = users.order_by(User.username).all() return render_template("chuds.html", v=v, users=users) def all_upvoters_downvoters(v, username, vote_dir, is_who_simps_hates):