forked from rDrama/rDrama
1
0
Fork 0

rename variable

master
Aevann 2023-06-29 22:51:32 +03:00
parent d888349f16
commit 778f4f045e
11 changed files with 16 additions and 16 deletions

View File

@ -374,14 +374,14 @@ class User(Base):
@lazy
def is_votes_real(self):
if self.patron: return True
if self.is_suspended_permanently or self.shadowbanned: return False
if self.is_permabanned or self.shadowbanned: return False
if self.chud: return False
if self.profile_url.startswith('/e/') and not self.customtitle and self.namecolor == DEFAULT_COLOR: return False
return True
@lazy
def mods(self, sub):
if self.is_suspended_permanently or self.shadowbanned: return False
if self.is_permabanned or self.shadowbanned: return False
if self.admin_level >= PERMS['MODS_EVERY_HOLE']: return True
try:
return any(map(lambda x: x.sub == sub, self.sub_mods))
@ -965,7 +965,7 @@ class User(Base):
@property
@lazy
def is_suspended_permanently(self):
def is_permabanned(self):
return (self.is_banned and self.unban_utc == 0)
@property
@ -1116,7 +1116,7 @@ class User(Base):
if self.client: return False
if self.blacklisted_by: return False
if self.shadowbanned: return False
if self.is_suspended_permanently: return False
if self.is_permabanned: return False
if self.admin_level >= PERMS['VIEW_RESTRICTED_HOLES']: return True
if self.truescore >= TRUESCORE_RESTRICTED_HOLES_MINIMUM: return True

View File

@ -969,7 +969,7 @@ def ban_user(id, v):
if user.admin_level > v.admin_level:
abort(403)
if user.is_suspended_permanently:
if user.is_permabanned:
abort(403, f"@{user.username} is already banned permanently!")
days = 0.0

View File

@ -573,7 +573,7 @@ def toggle_comment_nsfw(cid, v):
if comment.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (comment.post.sub and v.mods(comment.post.sub)):
abort(403)
if comment.over_18 and v.is_suspended_permanently:
if comment.over_18 and v.is_permabanned:
abort(403)
comment.over_18 = not comment.over_18

View File

@ -807,7 +807,7 @@ def mark_post_nsfw(pid, v):
if p.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (p.sub and v.mods(p.sub)):
abort(403)
if p.over_18 and v.is_suspended_permanently:
if p.over_18 and v.is_permabanned:
abort(403)
p.over_18 = True
@ -846,7 +846,7 @@ def unmark_post_nsfw(pid, v):
if p.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (p.sub and v.mods(p.sub)):
abort(403)
if p.over_18 and v.is_suspended_permanently:
if p.over_18 and v.is_permabanned:
abort(403)
p.over_18 = False

View File

@ -603,7 +603,7 @@ def messagereply(v:User):
parent = get_comment(id, v=v)
user_id = parent.author.id
if v.is_suspended_permanently and parent.sentto != MODMAIL_ID:
if v.is_permabanned and parent.sentto != MODMAIL_ID:
abort(403, "You are permabanned and may not reply to messages!")
elif v.is_muted and parent.sentto == MODMAIL_ID:
abort(403, "You are forbidden from replying to modmail!")

View File

@ -157,7 +157,7 @@ def is_not_permabanned(f):
def wrapper(*args, **kwargs):
v = get_logged_in_user()
if not v: abort(401)
if v.is_suspended_permanently: abort(403)
if v.is_permabanned: abort(403)
return make_response(f(*args, v=v, **kwargs))
wrapper.__name__ = f.__name__
return wrapper

View File

@ -17,7 +17,7 @@
{% set count=alts|length %}
<section class="userinfo-section">
<p><a href="/@{{u.username}}">@{{u.username}}</a> created their account {{u.created_utc|timestamp}} and has {{count}} known alt{{macros.plural(count)}}.<br>
They are {% if not u.is_suspended_permanently %}not {% endif %}permanently banned{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %} and they are {% if not u.shadowbanned %}not {% endif %}shadowbanned{% endif %}.</p>
They are {% if not u.is_permabanned %}not {% endif %}permanently banned{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %} and they are {% if not u.shadowbanned %}not {% endif %}shadowbanned{% endif %}.</p>
</section>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">

View File

@ -474,7 +474,7 @@
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.is_suspended %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
<button type="button" class="{% if c.author.is_suspended_permanently %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" class="{% if c.author.is_permabanned %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %}
@ -687,7 +687,7 @@
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.is_suspended %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</button>
<button type="button" class="list-group-item text-danger {% if c.author.is_suspended_permanently %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
<button type="button" class="list-group-item text-danger {% if c.author.is_permabanned %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
{% endif %}
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %}

View File

@ -87,7 +87,7 @@
<button type="button" id="unprogstack-{{p.id}}" class="dropdown-item {% if p.is_approved != PROGSTACK_ID %}d-none{% endif %} list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/unprogstack/post/{{p.id}}','progstack-{{p.id}}','unprogstack-{{p.id}}','d-none')"><i class="fas fa-bullhorn"></i>Remove Progressive Stack</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item {% if not p.author.is_suspended %}d-none{% endif %} list-inline-item text-success {% if p.author.is_suspended_permanently %}d-none{% endif %}" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')"><i class="fas fa-user-slash"></i>Unban user</button>
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item {% if not p.author.is_suspended %}d-none{% endif %} list-inline-item text-success {% if p.author.is_permabanned %}d-none{% endif %}" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')"><i class="fas fa-user-slash"></i>Unban user</button>
<button type="button" class="dropdown-item list-inline-item text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
{% endif %}

View File

@ -43,7 +43,7 @@
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" id="unban2-{{p.fullname}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-2"></i>Unban user</button>
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_suspended_permanently %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_permabanned %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
{% endif %}
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
<button type="button" id="unchud2-{{p.fullname}}" class="{% if not p.author.chud %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping mr-2"></i>Unchud user</button>

View File

@ -44,7 +44,7 @@
{% if v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" id="unban-{{deviceType}}" class="mt-1 {% if not u.is_suspended %}d-none{% endif %} btn btn-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{u.id}}')">Unban user</button>
<form class="my-3 {% if u.is_suspended_permanently %}d-none{% endif %}" action="/ban_user/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
<form class="my-3 {% if u.is_permabanned %}d-none{% endif %}" action="/ban_user/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
<input hidden name="formkey" value="{{v|formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-ban-submit-{{deviceType}}" required>
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" max="{{max_days()}}" placeholder="Days (blank = permanent)">