diff --git a/files/routes/comments.py b/files/routes/comments.py index f1b841633..9e027a862 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -610,10 +610,7 @@ def diff_words(answer, guess): def toggle_comment_nsfw(cid, v): comment = get_comment(cid) - if comment.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION'] and not (comment.post.hole and v.mods(comment.post.hole)): - abort(403) - - if comment.nsfw and v.is_permabanned: + if comment.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION'] and not (comment.post and comment.post.hole and v.mods(comment.post.hole)) and comment.wall_user_id != v.id: abort(403) comment.nsfw = not comment.nsfw @@ -627,7 +624,7 @@ def toggle_comment_nsfw(cid, v): target_comment_id = comment.id, ) g.db.add(ma) - else: + elif comment.post and comment.post.hole and v.mods(comment.post.hole): ma = HoleAction( hole = comment.post.hole, kind = "set_nsfw_comment" if comment.nsfw else "unset_nsfw_comment", diff --git a/files/templates/comments.html b/files/templates/comments.html index 95077cf97..c484c8802 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -480,7 +480,7 @@ {% endif %} - {% if FEATURES['NSFW_MARKING'] and (c.parent_post or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.hole and v.mods(c.post.hole))) %} + {% if FEATURES['NSFW_MARKING'] and (c.parent_post or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.hole and v.mods(c.post.hole))) or c.wall_user_id == v.id %} {% endif %} @@ -638,7 +638,7 @@ {% endif %} {% endif %} - {% if FEATURES['NSFW_MARKING'] and (c.author_id == v.id or (c.post.hole and v.mods(c.post.hole))) %} + {% if FEATURES['NSFW_MARKING'] and (c.author_id == v.id or (c.post.hole and v.mods(c.post.hole))) or c.wall_user_id == v.id %}