From 537e729195929fdf9abb615262f04f5c9c060bc5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 17 Dec 2022 17:57:50 +0200 Subject: [PATCH] fix this https://stupidpol.site/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/3256216?context=8#context --- files/routes/notifications.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 59a01c6f4..4826c9403 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -303,9 +303,9 @@ def notifications(v:User): next_exists = (len(comments) > PAGE_SIZE) comments = comments[:PAGE_SIZE] cids = [x[0].id for x in comments] - comms = get_comments(cids, v=v) listing = [] + total = [] for c, n in comments: if n.created_utc > 1620391248: c.notif_utc = n.created_utc if not n.read: @@ -316,6 +316,7 @@ def notifications(v:User): 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))).order_by(Comment.id.desc()).all() + total.extend(c.replies2) for x in c.replies2: if x.replies2 == None: x.replies2 = [] count = 0 @@ -324,15 +325,23 @@ def notifications(v:User): 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))).order_by(Comment.id.desc()).all() + total.extend(c.replies2) 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))).order_by(Comment.id.desc()).all() + total.extend(x.replies2) else: while c.parent_comment: c = c.parent_comment c.replies2 = g.db.query(Comment).filter_by(parent_comment_id=c.id).order_by(Comment.id).all() + total.extend(c.replies2) if c not in listing: listing.append(c) + + total.extend(listing) + + total_cids = [x.id for x in total] + output = get_comments_v_properties(v, True, None, Comment.id.in_(total_cids))[1] g.db.commit()