From 047a3fa44fe7f1e1947554777bda645d04d2bafb Mon Sep 17 00:00:00 2001 From: justcool393 Date: Fri, 25 Nov 2022 15:33:10 -0600 Subject: [PATCH] don't unnecessarily filter --- files/routes/users.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index e100825e8..3b3a530c2 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -950,8 +950,10 @@ def get_saves_and_subscribes(v, template, relationship_cls, page:int, standalone ids = [x[0] for x in g.db.query(query).join(join).filter(relationship_cls.user_id == v.id).order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()] next_exists = len(ids) > PAGE_SIZE ids = ids[:PAGE_SIZE] - - extra = None if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] else lambda q:q.filter(cls.is_banned == False, cls.deleted_utc == 0) + + extra = None + if not v.admin_level >= PERMS['POST_COMMENT_MODERATION']: + extra = lambda q:q.filter(cls.is_banned == False, cls.deleted_utc == 0) if cls is Submission: listing = get_posts(ids, v=v, eager=True, extra=extra) @@ -959,8 +961,6 @@ def get_saves_and_subscribes(v, template, relationship_cls, page:int, standalone listing = get_comments(ids, v=v, extra=extra) else: raise TypeError("Only supports Submissions and Comments. This is probably the result of a bug with *this* function") - - listing = [item for item in listing if not (item.is_banned or item.deleted_utc)] if v.client: return {"data": [x.json(g.db) for x in listing]} return render_template(template, u=v, v=v, listing=listing, page=page, next_exists=next_exists, standalone=standalone)