always show parent comment in /notifications

pull/134/head
Aevann 2023-02-26 13:14:18 +02:00
parent 686f88e9cf
commit 825cee14eb
1 changed files with 11 additions and 1 deletions

View File

@ -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)