From e048b691f1def837900ec2592374bf4bc8c55190 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 17 Apr 2022 19:16:15 +0200 Subject: [PATCH] dfs --- files/routes/front.py | 49 ++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 484b933d6a..0912425001 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -92,50 +92,35 @@ def notifications(v): g.db.commit() next_exists = (len(notifications) > len(listing)) - else: - comments = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter( - Notification.user_id == v.id, - Comment.author_id != AUTOJANNY_ID, - Comment.body_html.notlike('%

New site mention: 2)): + comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None) + + comments = comments.offset(25 * (page - 1)).limit(26).all() - if v and (v.shadowbanned or v.admin_level > 2): - comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).order_by(sq.c.created_utc.desc()).offset(25 * (page - 1)).limit(26).all() - else: - comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None).order_by(sq.c.created_utc.desc()).offset(25 * (page - 1)).limit(26).all() - next_exists = (len(comments) > 25) comments = comments[:25] - cids = [x[0] for x in g.db.query(Comment.id).join(Notification, Notification.comment_id == Comment.id).filter( - Notification.user_id == v.id, - Comment.is_banned == False, - Comment.deleted_utc == 0, - Comment.author_id != AUTOJANNY_ID, - Comment.body_html.notlike('%

New site mention: