From b99bc05bb3bebd6dc0fe284b00196703b46de4e3 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 12 Aug 2023 22:32:30 +0300 Subject: [PATCH] do this https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/4740259#context --- files/routes/comments.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 245c4cdc9..e4c29ddf5 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -64,16 +64,21 @@ def post_pid_comment_cid(cid, v, pid=None, anything=None, sub=None): except: context = 8 comment_info = comment c = comment - while context and c.level > 1: - c = c.parent_comment - context -= 1 - top_comment = c if post.new: defaultsortingcomments = 'new' elif v: defaultsortingcomments = v.defaultsortingcomments else: defaultsortingcomments = "hot" sort=request.values.get("sort", defaultsortingcomments) + while context and c.level > 1: + parent = c.parent_comment + replies = parent.replies(sort) + replies.remove(c) + parent.replies2 = [c] + replies + c = parent + context -= 1 + top_comment = c + if v: # this is required because otherwise the vote and block # props won't save properly unless you put them in a list