diff --git a/files/classes/user.py b/files/classes/user.py index 45d80591a..af7e39582 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -115,6 +115,7 @@ class User(Base): is_banned = Column(Integer, ForeignKey("users.id")) unban_utc = Column(Integer) ban_reason = deferred(Column(String)) + shadowban_reason = deferred(Column(String)) is_muted = Column(Boolean, default=False) login_nonce = Column(Integer, default=0) coins = Column(Integer, default=DEFAULT_COINS) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index e4bf16994..955c7fd6c 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -540,7 +540,7 @@ def execute_under_siege(v, target, body, kind): if v.shadowbanned: return v.shadowbanned = AUTOJANNY_ID - v.ban_reason = "Under Siege" + v.shadowban_reason = "Under Siege" g.db.add(v) if kind == "report": diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 4a11d9af3..62da5df83 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -148,7 +148,7 @@ def execute_blackjack(v, target, body, kind): ) g.db.add(ma) - v.ban_reason = f"Blackjack: {kind}" + v.shadowban_reason = f"Blackjack: {kind}" g.db.add(v) notified_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['BLACKJACK_NOTIFICATIONS'])] diff --git a/files/routes/admin.py b/files/routes/admin.py index 39812c004..d5a279efa 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -256,6 +256,7 @@ def revert_actions(v, username): user.shadowbanned = None user.unban_utc = None user.ban_reason = None + user.shadowban_reason = None if user.is_banned: user.is_banned = None send_repeatable_notification(user.id, f"@{v.username} (a site admin) has unbanned you!") @@ -265,6 +266,7 @@ def revert_actions(v, username): u.shadowbanned = None u.unban_utc = None u.ban_reason = None + u.shadowban_reason = None if u.is_banned: u.is_banned = None send_repeatable_notification(u.id, f"@{v.username} (a site admin) has unbanned you!") @@ -882,7 +884,7 @@ def shadowban(user_id, v): if len(reason) > 256: abort(400, "Ban reason too long!") - user.ban_reason = reason + user.shadowban_reason = reason g.db.add(user) check_for_alts(user) @@ -907,12 +909,12 @@ def shadowban(user_id, v): def unshadowban(user_id, v): user = get_account(user_id) user.shadowbanned = None - if not user.is_banned: user.ban_reason = None + user.shadowban_reason = None g.db.add(user) for alt in get_alt_graph(user.id): alt.shadowbanned = None - if not alt.is_banned: alt.ban_reason = None + alt.shadowban_reason = None g.db.add(alt) ma = ModAction( @@ -1214,8 +1216,7 @@ def unban_user(fullname, v): user.is_banned = None user.unban_utc = None - if not user.shadowbanned: - user.ban_reason = None + user.ban_reason = None send_repeatable_notification(user.id, f"@{v.username} (a site admin) has unbanned you!") g.db.add(user) @@ -1223,8 +1224,7 @@ def unban_user(fullname, v): if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} (a site admin) has unbanned you!") x.is_banned = None x.unban_utc = None - if not x.shadowbanned: - x.ban_reason = None + x.ban_reason = None g.db.add(x) ma = ModAction( diff --git a/files/routes/awards.py b/files/routes/awards.py index 88a7ccea3..77c2bf929 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -292,8 +292,7 @@ def award_thing(v, thing_type, id): else: author.unban_utc = None author.is_banned = None - if not author.shadowbanned: - author.ban_reason = None + author.ban_reason = None send_repeatable_notification(author.id, "You have been unbanned!") elif kind == "grass": link3 = f"/{thing_type}/{obj.id}" diff --git a/files/routes/routehelpers.py b/files/routes/routehelpers.py index bca65652c..654014383 100644 --- a/files/routes/routehelpers.py +++ b/files/routes/routehelpers.py @@ -103,11 +103,11 @@ def check_for_alts(current, include_current_session=False): for u in get_alt_graph(current.id): if u.shadowbanned and not current.shadowbanned: current.shadowbanned = u.shadowbanned - current.ban_reason = u.ban_reason + current.shadowban_reason = u.shadowban_reason g.db.add(current) elif current.shadowbanned and not u.shadowbanned: u.shadowbanned = current.shadowbanned - u.ban_reason = current.ban_reason + u.shadowban_reason = current.shadowban_reason g.db.add(u) elif u.is_permabanned and not current.is_permabanned: current.is_banned = u.is_banned @@ -120,11 +120,6 @@ def check_for_alts(current, include_current_session=False): u.unban_utc = None g.db.add(u) - if current.ban_reason == "Under Siege" and u.ban_reason and u.ban_reason != "Under Siege": - current.ban_reason = u.ban_reason - elif u.ban_reason == "Under Siege" and current.ban_reason and current.ban_reason != "Under Siege": - u.ban_reason = current.ban_reason - if u.is_muted and not current.is_muted: current.is_muted = u.is_muted g.db.add(current) diff --git a/files/templates/admin/shadowbanned.html b/files/templates/admin/shadowbanned.html index 6f53dbac4..20c117a38 100644 --- a/files/templates/admin/shadowbanned.html +++ b/files/templates/admin/shadowbanned.html @@ -27,7 +27,7 @@