tweaking bannedfor column

remotes/1693045480750635534/spooky-22
Aevann1 2022-07-12 22:00:19 +02:00
parent 077353c1f4
commit 093c83d7c9
4 changed files with 9 additions and 6 deletions

View File

@ -255,6 +255,7 @@ def revert_actions(v, username):
for item in posts + comments:
item.is_banned = False
item.ban_reason = None
item.is_approved = v.id
g.db.add(item)
users = (x[0] for x in g.db.query(ModAction.target_user_id).filter(ModAction.user_id == user.id, ModAction.created_utc > cutoff, ModAction.kind.in_(('shadowban', 'ban_user'))).all())
@ -1014,9 +1015,9 @@ def ban_user(user_id, v):
send_repeatable_notification(user.id, text)
if days == 0: duration = "permanent"
elif days == 1: duration = "1 day"
else: duration = f"{days} days"
if days == 0: duration = "permanently"
elif days == 1: duration = "for 1 day"
else: duration = f"for {days} days"
note = f'reason: "{reason}", duration: {duration}'
ma=ModAction(
@ -1488,6 +1489,7 @@ def admin_nunuke_user(v):
post.is_banned = False
post.ban_reason = None
post.is_approved = v.id
g.db.add(post)
for comment in g.db.query(Comment).filter_by(author_id=user.id).all():
@ -1496,6 +1498,7 @@ def admin_nunuke_user(v):
comment.is_banned = False
comment.ban_reason = None
comment.is_approved = v.id
g.db.add(comment)
ma=ModAction(

View File

@ -175,7 +175,7 @@
{% endif %}
{% if c.bannedfor %}
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this comment for {{c.bannedfor}}"></i>
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this comment {{c.bannedfor}}"></i>
{% endif %}
{% if c.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px"role="button" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Report{{ help.plural(c.active_flags(v)) }}</a>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}

View File

@ -636,7 +636,7 @@
{% endif %}
{% if p.bannedfor %}
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post for {{p.bannedfor}}"></i>
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post {{p.bannedfor}}"></i>
{% endif %}
{% for a in p.awards %}

View File

@ -163,7 +163,7 @@
{% endif %}
{% if p.bannedfor %}
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post for {{p.bannedfor}}"></i>
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post {{p.bannedfor}}"></i>
{% endif %}
{% for a in p.awards %}