From 327176d31b5f2e2e31881b4fa54116340ee5c209 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 10 Sep 2022 11:06:34 +0200 Subject: [PATCH] show most recent replies in /notifications at the top --- files/routes/notifications.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 38271f791..91fd81de4 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -274,7 +274,7 @@ def notifications(v): if c.parent_submission: if c.replies2 == None: - c.replies2 = g.db.query(Comment).filter_by(parent_comment_id=c.id).filter(or_(Comment.author_id == v.id, Comment.id.in_(cids))).all() + c.replies2 = g.db.query(Comment).filter_by(parent_comment_id=c.id).filter(or_(Comment.author_id == v.id, Comment.id.in_(cids))).order_by(Comment.id.desc()).all() for x in c.replies2: if x.replies2 == None: x.replies2 = [] count = 0 @@ -282,10 +282,10 @@ def notifications(v): count += 1 c = c.parent_comment if c.replies2 == None: - c.replies2 = g.db.query(Comment).filter_by(parent_comment_id=c.id).filter(or_(Comment.author_id == v.id, Comment.id.in_(cids))).all() + c.replies2 = g.db.query(Comment).filter_by(parent_comment_id=c.id).filter(or_(Comment.author_id == v.id, Comment.id.in_(cids))).order_by(Comment.id.desc()).all() for x in c.replies2: if x.replies2 == None: - x.replies2 = g.db.query(Comment).filter_by(parent_comment_id=x.id).filter(or_(Comment.author_id == v.id, Comment.id.in_(cids))).all() + x.replies2 = g.db.query(Comment).filter_by(parent_comment_id=x.id).filter(or_(Comment.author_id == v.id, Comment.id.in_(cids))).order_by(Comment.id.desc()).all() else: while c.parent_comment: c = c.parent_comment