From b4a1fce122c372077f1306a54e8e7892c1c2d208 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 8 Aug 2021 01:14:32 +0200 Subject: [PATCH] gf --- files/routes/comments.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index c6184c2a3..cb5b75e78 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -58,14 +58,16 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): # context improver try: context = int(request.args.get("context", 0)) except: context = 0 + comment_info = comment while context > 0 and comment.level > 1: parent = get_comment(c.parent_comment_id, v=v) post.preloaded_comments += [parent] - c = parent + comment = parent context -= 1 + top_comment = comment if v: defaultsortingcomments = v.defaultsortingcomments else: defaultsortingcomments = "top" @@ -168,10 +170,10 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): post.tree_comments() - post.replies=[comment] + post.replies=[top_comment] - if request.headers.get("Authorization"): return comment.json - else: return post.rendered_page(v=v, sort=sort, comment=comment, comment_info=comment) + if request.headers.get("Authorization"): return top_comment.json + else: return post.rendered_page(v=v, sort=sort, comment=top_comment, comment_info=comment_info) @app.post("/comment")