From 299dbceeeb4fce511a1f8fdb2daf0f4f40ab16cb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 5 Nov 2022 04:48:02 +0200 Subject: [PATCH] only add reason if there's a reason --- files/helpers/actions.py | 2 +- files/routes/admin.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 7a31a7901..ff6f75add 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -163,7 +163,7 @@ def execute_snappy(post, v): text = f"@Snappy has banned you for **{days}** days for the following reason:\n\n> {reason}" send_repeatable_notification(v.id, text) duration = f"for {days} days" - note = f'reason: "{reason}", duration: {duration}' + note = f'duration: {duration}, reason: "{reason}"' ma=ModAction( kind="ban_user", user_id=snappy.id, diff --git a/files/routes/admin.py b/files/routes/admin.py index 458cac1a3..13071d0ad 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -968,7 +968,7 @@ def ban_user(user_id, v): send_repeatable_notification(user.id, text) - note = f'reason: "{reason}", duration: {duration}' + note = f'duration: {duration}, reason: "{reason}"' ma=ModAction( kind="ban_user", user_id=v.id, @@ -1029,7 +1029,9 @@ def agendaposter(user_id, v): send_repeatable_notification(user.id, text) - note = f'reason: "{reason}", duration: {duration}' + note = f'duration: {duration}' + if reason: note += f', reason: "{reason}"' + ma=ModAction( kind="agendaposter", user_id=v.id,