diff --git a/files/routes/front.py b/files/routes/front.py index c683ca6396..4654d586b4 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -38,6 +38,7 @@ 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') @@ -49,10 +50,9 @@ 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, Comment.level == 1).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, not_(Comment.child_comments.any())).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,50 +90,38 @@ def notifications(v): next_exists = (len(notifications) > len(listing)) else: - 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: