forked from rDrama/rDrama
remove unnecessary function
parent
b950c9107a
commit
73649e987c
|
@ -1091,7 +1091,7 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def json(self):
|
def json(self):
|
||||||
if self.is_suspended:
|
if self.is_banned:
|
||||||
return {'username': self.username,
|
return {'username': self.username,
|
||||||
'original_username': self.original_username,
|
'original_username': self.original_username,
|
||||||
'url': self.url,
|
'url': self.url,
|
||||||
|
@ -1138,12 +1138,6 @@ class User(Base):
|
||||||
self.ban_reason = reason
|
self.ban_reason = reason
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
|
||||||
@lazy
|
|
||||||
def is_suspended(self):
|
|
||||||
return (self.is_banned and (not self.unban_utc or self.unban_utc > time.time()))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def is_permabanned(self):
|
def is_permabanned(self):
|
||||||
|
|
|
@ -982,7 +982,7 @@ forced_hats = {
|
||||||
"sharpen": ("Bane Mask", "No one understands..."),
|
"sharpen": ("Bane Mask", "No one understands..."),
|
||||||
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
|
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
|
||||||
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
|
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
|
||||||
"is_suspended": ("Behind Bars", "This user is banned and needs to do better!"),
|
"is_banned": ("Behind Bars", "This user is banned and needs to do better!"),
|
||||||
"chud": (
|
"chud": (
|
||||||
("Egg_irl", "This user is getting in touch with xir identity!"),
|
("Egg_irl", "This user is getting in touch with xir identity!"),
|
||||||
("Trans Flag", "Just in case you forgot, trans lives matter."),
|
("Trans Flag", "Just in case you forgot, trans lives matter."),
|
||||||
|
|
|
@ -364,13 +364,13 @@ def award_thing(v, thing_type, id):
|
||||||
if not emoji:
|
if not emoji:
|
||||||
abort(404, f'an Emoji with the name "{award.note}" was not found!')
|
abort(404, f'an Emoji with the name "{award.note}" was not found!')
|
||||||
elif kind == "ban":
|
elif kind == "ban":
|
||||||
if not author.is_suspended:
|
if not author.is_banned:
|
||||||
author.ban(reason=ban_reason, days=quantity)
|
author.ban(reason=ban_reason, days=quantity)
|
||||||
elif author.unban_utc:
|
elif author.unban_utc:
|
||||||
author.unban_utc += 86400 * quantity
|
author.unban_utc += 86400 * quantity
|
||||||
send_repeatable_notification(author.id, f"Your account has been banned for **{quantity} day{s}** for {obj.textlink}. It sucked and you should feel bad.")
|
send_repeatable_notification(author.id, f"Your account has been banned for **{quantity} day{s}** for {obj.textlink}. It sucked and you should feel bad.")
|
||||||
elif kind == "unban":
|
elif kind == "unban":
|
||||||
if not author.is_suspended or not author.unban_utc:
|
if not author.is_banned or not author.unban_utc:
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
if not author.ban_reason.startswith('Ban award'):
|
if not author.ban_reason.startswith('Ban award'):
|
||||||
|
|
|
@ -162,7 +162,7 @@ def is_not_banned(f):
|
||||||
v = get_logged_in_user()
|
v = get_logged_in_user()
|
||||||
if not v:
|
if not v:
|
||||||
abort(401, "You need to login to perform this action!")
|
abort(401, "You need to login to perform this action!")
|
||||||
if v.is_suspended:
|
if v.is_banned:
|
||||||
abort(403, "You can't perform this action while banned!")
|
abort(403, "You can't perform this action while banned!")
|
||||||
return make_response(f(*args, v=v, **kwargs))
|
return make_response(f(*args, v=v, **kwargs))
|
||||||
wrapper.__name__ = f.__name__
|
wrapper.__name__ = f.__name__
|
||||||
|
|
|
@ -504,7 +504,7 @@
|
||||||
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
|
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
|
||||||
<button type="button" class="{% if c.author.switched.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_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
<button type="button" class="{% if c.author.switched.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_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
||||||
|
|
||||||
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.switched.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" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.switched.is_banned %}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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %}
|
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %}
|
||||||
|
@ -736,7 +736,7 @@
|
||||||
|
|
||||||
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
||||||
<button type="button" class="list-group-item text-danger {% if c.author.switched.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_punish_modal}}', '{{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.switched.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_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
|
||||||
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.switched.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" id="unban2-{{c.fullname}}" class="{% if not c.author.switched.is_banned %}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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
|
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
|
||||||
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.is_permabanned %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.is_permabanned %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
||||||
|
|
||||||
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item list-inline-item text-success {% if not p.author.is_suspended %}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 list-inline-item text-success {% if not p.author.is_banned %}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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != p.author_id %}
|
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != p.author_id %}
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
||||||
<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_punish_modal}}', '{{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>
|
<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_punish_modal}}', '{{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>
|
||||||
|
|
||||||
<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" id="unban2-{{p.fullname}}" class="{% if not p.author.is_banned %}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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(by {{u.chudder | safe}}) - {{u.unchud_string}}
|
(by {{u.chudder | safe}}) - {{u.unchud_string}}
|
||||||
</h5>
|
</h5>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if u.is_suspended %}
|
{% if u.is_banned %}
|
||||||
<h5 class="text-primary" id="profile-{{deviceType}}--banned">BANNED USER:
|
<h5 class="text-primary" id="profile-{{deviceType}}--banned">BANNED USER:
|
||||||
{{u.ban_reason | safe}}
|
{{u.ban_reason | safe}}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
<input autocomplete="off" id="user-ban-submit-{{deviceType}}" type="submit" class="btn btn-danger" value="Ban user" disabled>
|
<input autocomplete="off" id="user-ban-submit-{{deviceType}}" type="submit" class="btn btn-danger" value="Ban user" disabled>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<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>
|
<button type="button" id="unban-{{deviceType}}" class="mt-1 {% if not u.is_banned %}d-none{% endif %} btn btn-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{u.id}}')">Unban user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
||||||
<form id="shadowban-{{deviceType}}" class="mt-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
|
<form id="shadowban-{{deviceType}}" class="mt-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
|
||||||
|
|
Loading…
Reference in New Issue