fix ban_reason getting wiped accidentially

pull/157/head
Aevann 2023-06-22 14:24:03 +03:00
parent e50bbe0da0
commit cc7176868d
2 changed files with 7 additions and 4 deletions

View File

@ -1157,7 +1157,8 @@ def unban_user(id, v):
user.is_banned = None
user.unban_utc = 0
user.ban_reason = None
if not user.shadowbanned:
user.ban_reason = None
send_repeatable_notification(user.id, f"@{v.username} (a site admin) has unbanned you!")
g.db.add(user)
@ -1165,7 +1166,8 @@ def unban_user(id, 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 = 0
x.ban_reason = None
if not x.shadowbanned:
x.ban_reason = None
g.db.add(x)
ma=ModAction(

View File

@ -269,7 +269,8 @@ def award_thing(v, thing_type, id):
else:
author.unban_utc = 0
author.is_banned = None
author.ban_reason = None
if not author.shadowbanned:
author.ban_reason = None
send_repeatable_notification(author.id, "You have been unbanned!")
elif kind == "grass":
link3 = f"/{thing_type}/{thing.id}"
@ -568,4 +569,4 @@ def get_number_tuple(input, mods):
result, input = shift_number_down(input, mod)
results.append(result)
results.append(input)
return results
return results