From 21e2e82807c2ca13e7c444bd48f34ea48e4b9f95 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 27 Jun 2024 13:30:46 +0300 Subject: [PATCH] make comment pins always work on default sort --- files/routes/posts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index ed4c0d92d..e0712f2ab 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -148,7 +148,7 @@ def post_id(pid, v, anything=None, hole=None): # output is needed: see comments.py comments, output = get_comments_v_properties(v, None, Comment.parent_post == p.id, Comment.level < 10) - if sort == "hot": + if sort == "hot" or sort == defaultsortingcomments: pinned = [c[0] for c in comments.filter(Comment.pinned != None).order_by(Comment.created_utc.desc())] comments = comments.filter(Comment.pinned == None) @@ -158,7 +158,7 @@ def post_id(pid, v, anything=None, hole=None): else: comments = g.db.query(Comment).filter(Comment.parent_post == p.id) - if sort == "hot": + if sort == "hot" or sort == defaultsortingcomments: pinned = comments.filter(Comment.pinned != None).order_by(Comment.created_utc.desc()).all() comments = comments.filter(Comment.pinned == None) @@ -193,7 +193,7 @@ def post_id(pid, v, anything=None, hole=None): p.replies = comments - if sort == "hot": + if sort == "hot" or sort == defaultsortingcomments: pinned2 = {} for pin in pinned: if pin.level > 1: