From c371b112893f4edda7202b4e6d9576ec00cddaa1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 4 Apr 2022 01:05:21 +0200 Subject: [PATCH] dsf --- files/routes/front.py | 58 ++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 4654d586b..c2d932748 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -38,7 +38,6 @@ def unread(v): @auth_required def notifications(v): t = time.time() - try: page = int(request.values.get('page', 1)) except: page = 1 messages = request.values.get('messages') @@ -50,9 +49,10 @@ def notifications(v): next_exists = (len(comments) > 25) comments = comments[:25] elif messages: - comments = g.db.query(Comment).filter(Comment.sentto != None, or_(Comment.author_id==v.id, Comment.sentto==v.id), Comment.parent_submission == None, not_(Comment.child_comments.any())).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all() + comments = g.db.query(Comment).filter(Comment.sentto != None, or_(Comment.author_id==v.id, Comment.sentto==v.id), Comment.parent_submission == None, Comment.level == 1).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all() next_exists = (len(comments) > 25) comments = comments[:25] + comments = [x.parent_comm] elif posts: notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ID).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all() @@ -90,38 +90,49 @@ def notifications(v): next_exists = (len(notifications) > len(listing)) else: - notifications = v.notifications.join(Notification.comment).distinct(Comment.top_comment_id).filter( + unread = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter( + Notification.read == False, + Notification.user_id == v.id, + Comment.author_id != AUTOJANNY_ID, + Comment.body_html.notlike('

New rdrama mention:

New rdrama mention: