From fabbc7a1a3e5e4c42d7a4b05186d7e97e6d5f422 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 4 Oct 2022 22:10:59 +0200 Subject: [PATCH] allow hole jannies to mark posts and comments in their holes as +18 --- files/routes/posts.py | 4 ++-- files/templates/comments.html | 14 ++++++++------ files/templates/post_actions.html | 2 +- files/templates/post_actions_mobile.html | 9 +++++---- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 57058d3d2..2eb00167b 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1110,7 +1110,7 @@ def undelete_post_pid(pid, v): def toggle_comment_nsfw(cid, v): comment = get_comment(cid) - if comment.author_id != v.id and not v.admin_level > 1: + if comment.author_id != v.id and not v.admin_level > 1 and not (comment.post.sub and v.mods(comment.post.sub)): abort(403) comment.over_18 = not comment.over_18 @@ -1132,7 +1132,7 @@ def toggle_comment_nsfw(cid, v): def toggle_post_nsfw(pid, v): post = get_post(pid) - if post.author_id != v.id and not v.admin_level > 1: + if post.author_id != v.id and not v.admin_level > 1 and not (post.sub and v.mods(post.sub)): abort(403) post.over_18 = not post.over_18 diff --git a/files/templates/comments.html b/files/templates/comments.html index 1f9352415..118f6ffb6 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -480,9 +480,9 @@ {% endif %} {% endif %} -{% if c.parent_submission and (c.author_id==v.id or v.admin_level > 1) %} - - +{% if c.parent_submission and (c.author_id==v.id or v.admin_level > 1 or (c.post.sub and v.mods(c.post.sub))) %} + + {% endif %} {% if v.admin_level > 1 and v.id != c.author_id %} @@ -636,9 +636,6 @@ Undelete Delete - - Mark +18 - Unmark +18 {% else %} {% if c.body %} View source @@ -651,6 +648,11 @@ {% endif %} {% endif %} + {% if c.author_id == v.id or (c.post.sub and v.mods(c.post.sub)) %} + Mark +18 + Unmark +18 + {% endif %} + {% if v.admin_level < 2 %} {% if c.post and v.id == c.post.author_id %} Pin diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 541b7f11c..25a390100 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -93,7 +93,7 @@ {% endif %} - {% if v.id==p.author_id or v.admin_level > 1 %} + {% if v.id==p.author_id or v.admin_level > 1 or (p.sub and v.mods(p.sub)) %} Mark +18 Unmark +18 {% endif %} diff --git a/files/templates/post_actions_mobile.html b/files/templates/post_actions_mobile.html index e925f0b59..d0d96a38e 100644 --- a/files/templates/post_actions_mobile.html +++ b/files/templates/post_actions_mobile.html @@ -43,11 +43,7 @@ {%- endif %} - - - {% else %} - {% if not p.ghost %} @@ -55,6 +51,11 @@ {% endif %} {% endif %} +{% if v.id==p.author_id or (p.sub and v.mods(p.sub)) %} + + +{% endif %} + {% if p.sub and v.mods(p.sub) %}