From 093c83d7c9781a79e8608c081bf193c59bd4858c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 12 Jul 2022 22:00:19 +0200 Subject: [PATCH] tweaking bannedfor column --- files/routes/admin.py | 9 ++++++--- files/templates/comments.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index b8c09aa4e..6206c086e 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -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( diff --git a/files/templates/comments.html b/files/templates/comments.html index c6ef8d097..e054e7f88 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -175,7 +175,7 @@ {% endif %} {% if c.bannedfor %} - + {% endif %} {% if c.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{c.active_flags(v)}} Report{{ help.plural(c.active_flags(v)) }}{% endif %} {% if c.over_18 %}+18{% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 8189dbd20..64b41114a 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -636,7 +636,7 @@ {% endif %} {% if p.bannedfor %} - + {% endif %} {% for a in p.awards %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index ddaec44f1..35591eab1 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -163,7 +163,7 @@ {% endif %} {% if p.bannedfor %} - + {% endif %} {% for a in p.awards %}