From a0378e83abbb3b513601f966e982fe01651f19c2 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 10 Feb 2023 15:48:31 +0200 Subject: [PATCH] revert --- files/routes/posts.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 194785bc5..210b0fcf5 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -99,15 +99,14 @@ def post_id(pid, anything=None, v=None, sub=None): if v: execute_shadowban_viewers_and_voters(v, post) - - comments = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.level < 10) - - pinned = comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all() + # shadowban check is done in sort_objects + # output is needed: see comments.py + comments, output = get_comments_v_properties(v, True, None, Comment.parent_submission == post.id, Comment.level < 10) + pinned = [c[0] for c in comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()] comments = comments.filter(Comment.level == 1, Comment.stickied == None) - - comments = sort_objects(sort, comments, Comment, include_shadowbanned=(v and v.can_see_shadowbanned)) - - comments = comments.all() + comments = sort_objects(sort, comments, Comment, + include_shadowbanned=(v and v.can_see_shadowbanned)) + comments = [c[0] for c in comments.all()] else: pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.stickied != None).order_by(Comment.created_utc.desc()).all() @@ -149,7 +148,6 @@ def post_id(pid, anything=None, v=None, sub=None): pinned2 = {} for pin in pinned: - ids.add(pin.id) if pin.stickied_utc and int(time.time()) > pin.stickied_utc: pin.stickied = None pin.stickied_utc = None @@ -166,9 +164,6 @@ def post_id(pid, anything=None, v=None, sub=None): post.views += 1 g.db.add(post) - if v: - y, output = get_comments_v_properties(v, True, None, Comment.top_comment_id.in_(ids), Comment.level < 10) - if v and v.client: return post.json(g.db)