From 6198f949564385bdad6e0719b048c5ac310338e6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 6 Jan 2022 19:21:30 +0200 Subject: [PATCH] fds --- files/routes/front.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 66e0c6279..6477fdc10 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -25,17 +25,20 @@ def clear(v): def notifications(v): try: page = int(request.values.get('page', 1)) except: page = 1 - messages = request.values.get('messages', False) - modmail = request.values.get('modmail', False) - posts = request.values.get('posts', False) + messages = request.values.get('messages') + modmail = request.values.get('modmail') + posts = request.values.get('posts') if modmail and v.admin_level > 1: comments = g.db.query(Comment).filter(Comment.sentto==0).order_by(Comment.created_utc.desc()).offset(25*(page-1)).limit(26).all() next_exists = (len(comments) > 25) comments = comments[:25] elif messages: - comments = g.db.query(Comment).filter(or_(Comment.author_id==v.id, Comment.sentto==v.id), Comment.parent_submission == None).order_by(Comment.created_utc.desc(), not_(Comment.child_comments.any())).offset(25*(page-1)).limit(26).all() + + comments = g.db.query(Comment).distinct(Comment.parent_comment_id).filter(or_(Comment.author_id==v.id, Comment.sentto==v.id), Comment.parent_submission == None, not_(Comment.child_comments.any())).order_by(Comment.parent_comment_id.desc()).offset(25*(page-1)).limit(26).all() + next_exists = (len(comments) > 25) comments = comments[:25] + elif posts: notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ID).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(101).all()