diff --git a/files/routes/comments.py b/files/routes/comments.py index edcba68f2..e62242177 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -53,21 +53,22 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): if request.headers.get("Authorization"): return {'error': f'This content is not suitable for some users and situations.'} else: render_template("errors/nsfw.html", v=v) - post.preloaded_comments = [comment] + post._preloaded_comments = [comment] # context improver try: context = int(request.args.get("context", 0)) except: context = 0 comment_info = comment - while context > 0 and comment.level > 1: + c = comment + while context > 0 and c.level > 1: - parent = get_comment(comment.parent_comment_id, v=v) + parent = get_comment(c.parent_comment_id, v=v) - post.preloaded_comments += [parent] + post._preloaded_comments += [parent] - comment = parent + c = parent context -= 1 - top_comment = comment + top_comment = c if v: defaultsortingcomments = v.defaultsortingcomments else: defaultsortingcomments = "top" @@ -132,7 +133,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): for c in comments: comment = c[0] if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue - comment.voted = c[1] or 0 + comment._voted = c[1] or 0 comment._is_blocking = c[2] or 0 comment._is_blocked = c[3] or 0 output.append(comment) @@ -163,7 +164,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): abort(422) - post.preloaded_comments += output + post._preloaded_comments += output current_ids = [x.id for x in output] @@ -877,4 +878,4 @@ def unsave_comment(cid, v): g.db.delete(save) - return "", 204 + return "", 204 \ No newline at end of file