diff --git a/files/classes/comment.py b/files/classes/comment.py index 412d0d1fd5..60aad3240c 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -225,6 +225,12 @@ class Comment(Base): def shortlink(self): return f"/comment/{self.id}#context" + @property + @lazy + def author_name(self): + if self.post and (self.award_count('ghosts') or self.post.award_count('ghosts')): return '👻' + else: return self.author.username + @property @lazy def permalink(self): diff --git a/files/helpers/const.py b/files/helpers/const.py index cbfa61e79a..fd43407af9 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -548,7 +548,7 @@ AWARDS = { "ghosts": { "kind": "ghosts", "title": "Ghosts", - "description": "???", + "description": "Hides the usernames of everyone in the thread", "icon": "fas fa-ghost", "color": "text-white", "price": 200 diff --git a/files/routes/awards.py b/files/routes/awards.py index 6a4ed52d27..6798845aa5 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -207,6 +207,8 @@ def award_post(pid, v): if not post: return {"error": "That post doesn't exist."}, 404 + if kind == "ghosts" and post.distinguish_level: return {"error": "You can't use the ghosts award on distinguished posts."}, 403 + post_award.submission_id = post.id g.db.add(post_award) @@ -405,6 +407,8 @@ def award_comment(cid, v): if not c: return {"error": "That comment doesn't exist."}, 404 + if kind == "ghosts" and c.distinguish_level: return {"error": "You can't use the ghosts award on distinguished comments."}, 403 + comment_award.comment_id = c.id g.db.add(comment_award) diff --git a/files/routes/comments.py b/files/routes/comments.py index 7a8218f272..158e07a708 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -126,7 +126,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): else: if post.is_banned and not (v and (v.admin_level > 1 or post.author_id == v.id)): template = "submission_banned.html" else: template = "submission.html" - return render_template(template, v=v, p=post, sort=sort, linked_comment=comment, comment_info=comment_info, render_replies=True) + return render_template(template, v=v, p=post, sort=sort, comment_info=comment_info, render_replies=True) @app.post("/comment") diff --git a/files/templates/comments.html b/files/templates/comments.html index 2e3e98f602..3d4e9d5356 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -97,7 +97,7 @@
@@ -178,9 +178,9 @@ {% set isreply = False %} {% endif %} -