Move a bunch of moderation tools to admin level 2
This commit is contained in:
parent
f5c3d944e8
commit
20fa9ce79f
8 changed files with 13 additions and 17 deletions
|
@ -174,7 +174,7 @@ class User(Base):
|
||||||
|
|
||||||
|
|
||||||
def can_manage_reports(self):
|
def can_manage_reports(self):
|
||||||
return self.admin_level > 2
|
return self.admin_level > 1
|
||||||
|
|
||||||
def should_comments_be_filtered(self):
|
def should_comments_be_filtered(self):
|
||||||
if self.admin_level > 0:
|
if self.admin_level > 0:
|
||||||
|
@ -550,8 +550,8 @@ class User(Base):
|
||||||
'profile_url': self.profile_url,
|
'profile_url': self.profile_url,
|
||||||
'bannerurl': self.banner_url,
|
'bannerurl': self.banner_url,
|
||||||
'bio_html': self.bio_html_eager,
|
'bio_html': self.bio_html_eager,
|
||||||
'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 2)) else self.post_count,
|
'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 1)) else self.post_count,
|
||||||
'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 2)) else self.comment_count,
|
'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 1)) else self.comment_count,
|
||||||
'badges': [x.path for x in self.badges],
|
'badges': [x.path for x in self.badges],
|
||||||
'notes': [x.json() for x in self.notes]
|
'notes': [x.json() for x in self.notes]
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ def get_comments(cids, v=None, load_parent=False):
|
||||||
blocked.c.target_id,
|
blocked.c.target_id,
|
||||||
).filter(Comment.id.in_(cids))
|
).filter(Comment.id.in_(cids))
|
||||||
|
|
||||||
if not (v and (v.shadowbanned or v.admin_level > 2)):
|
if not (v and (v.shadowbanned or v.admin_level > 1)):
|
||||||
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
|
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
|
||||||
|
|
||||||
comments = comments.join(
|
comments = comments.join(
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ def sticky_post(post_id, v):
|
||||||
if post and not post.stickied:
|
if post and not post.stickied:
|
||||||
pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
||||||
if pins > 2:
|
if pins > 2:
|
||||||
if v.admin_level > 2:
|
if v.admin_level > 1:
|
||||||
post.stickied = v.username
|
post.stickied = v.username
|
||||||
post.stickied_utc = int(time.time()) + 3600
|
post.stickied_utc = int(time.time()) + 3600
|
||||||
else: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
|
else: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
|
||||||
|
|
|
@ -174,10 +174,6 @@ def api_comment(v):
|
||||||
|
|
||||||
body = request.values.get("body", "").strip()[:10000]
|
body = request.values.get("body", "").strip()[:10000]
|
||||||
|
|
||||||
if v.admin_level > 2 and parent_post.id == 37749 and level == 1:
|
|
||||||
with open(f"snappy_{SITE_ID}.txt", "a", encoding="utf-8") as f:
|
|
||||||
f.write('\n{[para]}\n' + body)
|
|
||||||
|
|
||||||
if parent_post.id not in ADMINISTRATORS:
|
if parent_post.id not in ADMINISTRATORS:
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
return {"error":"You have to type more than 280 characters!"}, 403
|
return {"error":"You have to type more than 280 characters!"}, 403
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
{% set downs=c.downvotes %}
|
{% set downs=c.downvotes %}
|
||||||
{% set score=ups-downs %}
|
{% set score=ups-downs %}
|
||||||
|
|
||||||
{% if v and (v.shadowbanned or v.admin_level > 2) %}
|
{% if v and (v.shadowbanned or v.admin_level > 1) %}
|
||||||
{% set replies=c.replies_ignoring_shadowbans %}
|
{% set replies=c.replies_ignoring_shadowbans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set replies=c.replies(v) %}
|
{% set replies=c.replies(v) %}
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
{{c.print()}}
|
{{c.print()}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="/@{{c.author_name}}" class="user-name" onclick='popclick({{c.author.json_popover(v) | tojson}})' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" role="button" tabindex="0" style="font-size:12px; font-weight:bold;"><img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.namecolor}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span></a>
|
<a href="/@{{c.author_name}}" class="user-name" onclick='popclick({{c.author.json_popover(v) | tojson}})' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" role="button" tabindex="0" style="font-size:12px; font-weight:bold;"><img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.namecolor}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span></a>
|
||||||
{% if v and v.admin_level > 2 %}
|
{% if v and v.admin_level > 1 %}
|
||||||
<span
|
<span
|
||||||
class="usernote-link"
|
class="usernote-link"
|
||||||
data-micromodal-trigger="modal-1"
|
data-micromodal-trigger="modal-1"
|
||||||
|
@ -435,7 +435,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v and v.admin_level > 2 and c.filter_state == 'filtered' %}
|
{% if v and v.admin_level > 1 and c.filter_state == 'filtered' %}
|
||||||
<button class="btn" role="button" id="filter-approve" onclick="filter_new_comment_status({{ c.id }}, 'normal')"><span>Approve</span></button>
|
<button class="btn" role="button" id="filter-approve" onclick="filter_new_comment_status({{ c.id }}, 'normal')"><span>Approve</span></button>
|
||||||
<button class="btn" role="button" id="filter-remove" onclick="filter_new_comment_status({{ c.id }}, 'removed')"><span>Remove</span></button>
|
<button class="btn" role="button" id="filter-remove" onclick="filter_new_comment_status({{ c.id }}, 'removed')"><span>Remove</span></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -825,7 +825,7 @@
|
||||||
|
|
||||||
{% if v and v.admin_level > 1 %}
|
{% if v and v.admin_level > 1 %}
|
||||||
<script src="{{ 'js/comments_admin.js' | asset }}"></script>
|
<script src="{{ 'js/comments_admin.js' | asset }}"></script>
|
||||||
{% if v.admin_level > 2 %}
|
{% if v.admin_level > 1 %}
|
||||||
<script src="{{ 'js/filter_actions.js' | asset }}"></script>
|
<script src="{{ 'js/filter_actions.js' | asset }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<a id="delete2-{{p.id}}" class="{% if p.deleted_utc %}d-none{% endif %} list-inline-item" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a>
|
<a id="delete2-{{p.id}}" class="{% if p.deleted_utc %}d-none{% endif %} list-inline-item" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v and v.admin_level > 2 and p.filter_state == 'filtered' %}
|
{% if v and v.admin_level > 1 and p.filter_state == 'filtered' %}
|
||||||
<a id="filter-approve" class="list-inline-item" role="button" onclick="filter_new_status({{p.id}}, 'normal')">Approve</a>
|
<a id="filter-approve" class="list-inline-item" role="button" onclick="filter_new_status({{p.id}}, 'normal')">Approve</a>
|
||||||
<a id="filter-remove" class="list-inline-item" role="button" onclick="filter_new_status({{p.id}}, 'removed')">Remove</a>
|
<a id="filter-remove" class="list-inline-item" role="button" onclick="filter_new_status({{p.id}}, 'removed')">Remove</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -185,7 +185,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a href="/@{{p.author_name}}" class="user-name" onclick='popclick({{p.author.json_popover(v) | tojson}})' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" role="button" tabindex="0" style="font-weight: bold"><img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span></a>{% if p.author.customtitle %} <bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>{% endif %}
|
<a href="/@{{p.author_name}}" class="user-name" onclick='popclick({{p.author.json_popover(v) | tojson}})' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" role="button" tabindex="0" style="font-weight: bold"><img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span></a>{% if p.author.customtitle %} <bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>{% endif %}
|
||||||
{% if v and v.admin_level > 2 %}
|
{% if v and v.admin_level > 1 %}
|
||||||
<span
|
<span
|
||||||
class="usernote-link"
|
class="usernote-link"
|
||||||
data-micromodal-trigger="modal-1"
|
data-micromodal-trigger="modal-1"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<script src="{{ 'js/new_comments_count.js' | asset }}"></script>
|
<script src="{{ 'js/new_comments_count.js' | asset }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v and v.admin_level > 2 %}
|
{% if v and v.admin_level > 1 %}
|
||||||
<script src="{{ 'js/filter_actions.js' | asset }}"></script>
|
<script src="{{ 'js/filter_actions.js' | asset }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@
|
||||||
class="mod"
|
class="mod"
|
||||||
{% endif %}>{{p.author_name}}</span>
|
{% endif %}>{{p.author_name}}</span>
|
||||||
</a>{% if p.author.customtitle %}<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>{% endif %}
|
</a>{% if p.author.customtitle %}<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>{% endif %}
|
||||||
{% if v and v.admin_level > 2 %}
|
{% if v and v.admin_level > 1 %}
|
||||||
<span
|
<span
|
||||||
class="usernote-link"
|
class="usernote-link"
|
||||||
data-micromodal-trigger="modal-1"
|
data-micromodal-trigger="modal-1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue