tweaking bannedfor column

master
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: for item in posts + comments:
item.is_banned = False item.is_banned = False
item.ban_reason = None item.ban_reason = None
item.is_approved = v.id
g.db.add(item) 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()) 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) send_repeatable_notification(user.id, text)
if days == 0: duration = "permanent" if days == 0: duration = "permanently"
elif days == 1: duration = "1 day" elif days == 1: duration = "for 1 day"
else: duration = f"{days} days" else: duration = f"for {days} days"
note = f'reason: "{reason}", duration: {duration}' note = f'reason: "{reason}", duration: {duration}'
ma=ModAction( ma=ModAction(
@ -1488,6 +1489,7 @@ def admin_nunuke_user(v):
post.is_banned = False post.is_banned = False
post.ban_reason = None post.ban_reason = None
post.is_approved = v.id
g.db.add(post) g.db.add(post)
for comment in g.db.query(Comment).filter_by(author_id=user.id).all(): 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.is_banned = False
comment.ban_reason = None comment.ban_reason = None
comment.is_approved = v.id
g.db.add(comment) g.db.add(comment)
ma=ModAction( ma=ModAction(

View File

@ -175,7 +175,7 @@
{% endif %} {% endif %}
{% if c.bannedfor %} {% 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 %} {% 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.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 %} {% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}

View File

@ -636,7 +636,7 @@
{% endif %} {% endif %}
{% if p.bannedfor %} {% 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 %} {% endif %}
{% for a in p.awards %} {% for a in p.awards %}

View File

@ -163,7 +163,7 @@
{% endif %} {% endif %}
{% if p.bannedfor %} {% 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 %} {% endif %}
{% for a in p.awards %} {% for a in p.awards %}