From 825cee14eb869a286ddb20fe18898f043cc9e69b Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 26 Feb 2023 13:14:18 +0200 Subject: [PATCH] always show parent comment in /notifications --- files/routes/notifications.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 14a474a35..71c9db9a5 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -348,7 +348,7 @@ def notifications(v:User): 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() total.extend(x.replies2) else: - while c.parent_comment: + while c.parent_comment_id: c = c.parent_comment c.replies2 = g.db.query(Comment).filter_by(parent_comment_id=c.id).order_by(Comment.id).all() @@ -356,6 +356,16 @@ def notifications(v:User): total.extend(listing) + listing2 = [] + for x in listing: + if x.parent_comment_id: + listing2.append(x.parent_comment) + else: + listing2.append(x) + listing = listing2 + + total.extend(listing) + total_cids = [x.id for x in total] total_cids.extend(cids) total_cids = set(total_cids)