From c4154ffa968b6a85918893d4ddeec5d1180270d8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 8 Aug 2021 01:11:49 +0200 Subject: [PATCH] fd --- files/helpers/get.py | 1 + files/routes/comments.py | 9 +++------ files/templates/votes.html | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/files/helpers/get.py b/files/helpers/get.py index 6498fedca..3eae1acab 100644 --- a/files/helpers/get.py +++ b/files/helpers/get.py @@ -190,6 +190,7 @@ def get_comment(i, v=None, graceful=False, **kwargs): vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=Comment.id).first() comment._is_blocking = block and block.user_id == v.id comment._is_blocked = block and block.target_id == v.id + print(vt.vote_type) comment.voted = vt.vote_type if vt else 0 else: diff --git a/files/routes/comments.py b/files/routes/comments.py index 583401651..277f12a07 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -58,8 +58,6 @@ 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 - c = comment while context > 0 and c.level > 1: parent = get_comment(c.parent_comment_id, v=v) @@ -68,7 +66,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): c = parent context -= 1 - top_comment = c if v: defaultsortingcomments = v.defaultsortingcomments else: defaultsortingcomments = "top" @@ -171,10 +168,10 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): post.tree_comments() - post.replies=[top_comment] + post.replies=[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) + if request.headers.get("Authorization"): return comment.json + else: return post.rendered_page(v=v, sort=sort, comment=comment, comment_info=comment) @app.post("/comment") diff --git a/files/templates/votes.html b/files/templates/votes.html index 54ea0d0dd..456aec3a7 100644 --- a/files/templates/votes.html +++ b/files/templates/votes.html @@ -20,8 +20,8 @@

{{thing.permalink}}

Author: @{{thing.author.username}}

Author Created At: {{thing.author.created_utc}} ({{thing.author.created_datetime}})

-

Upvotes: {{ups | length}}

-

Downvotes: 
{{downs | length}}

+

Upvotes: {{ups | length}}

+

Downvotes: {{downs | length}}

Upvotes