show most recent replies in /notifications at the top

master
Aevann1 2022-09-10 11:06:34 +02:00
parent c99343e9e0
commit 327176d31b
1 changed files with 3 additions and 3 deletions

View File

@ -274,7 +274,7 @@ def notifications(v):
if c.parent_submission: if c.parent_submission:
if c.replies2 == None: 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: for x in c.replies2:
if x.replies2 == None: x.replies2 = [] if x.replies2 == None: x.replies2 = []
count = 0 count = 0
@ -282,10 +282,10 @@ def notifications(v):
count += 1 count += 1
c = c.parent_comment c = c.parent_comment
if c.replies2 == None: 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: for x in c.replies2:
if x.replies2 == None: 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: else:
while c.parent_comment: while c.parent_comment:
c = c.parent_comment c = c.parent_comment