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