From 1bfcf58950b7b361b19e2f4dcebc0299cf25816c Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 16 Jan 2024 09:12:41 +0200 Subject: [PATCH] fix this https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/5751548#context --- files/routes/posts.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 964cf387e..aed9968e7 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -213,7 +213,11 @@ def view_more(v, pid, sort, offset): if v: # output is needed: see comments.py - comments, output = get_comments_v_properties(v, None, Comment.parent_post == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10) + comments, output = get_comments_v_properties(v, None, Comment.parent_post == pid, Comment.id.notin_(ids), Comment.level < 10) + + if sort == "hot": + comments = comments.filter(Comment.stickied == None) + comments = comments.filter(Comment.level == 1) comments = sort_objects(sort, comments, Comment) @@ -222,10 +226,12 @@ def view_more(v, pid, sort, offset): comments = g.db.query(Comment).filter( Comment.parent_post == pid, Comment.level == 1, - Comment.stickied == None, Comment.id.notin_(ids) ) + if sort == "hot": + comments = comments.filter(Comment.stickied == None) + comments = sort_objects(sort, comments, Comment) comments = comments.offset(offset).all()