From 7fc91eb6ef5ef0815bcef8bee9dd282ee488b92d Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 24 Apr 2024 14:07:10 +0200 Subject: [PATCH] fix plural + dedup --- files/routes/admin.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index da169b404..bab779cb0 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1034,18 +1034,15 @@ def ban_user(fullname, v): reason = reason_regex_post.sub(r'\1', reason) reason = reason_regex_comment.sub(r'\1', reason) - duration = "permanently" if days: days_txt = str(days) if days_txt.endswith('.0'): days_txt = days_txt[:-2] duration = f"for {days_txt} day" if days != 1: duration += "s" - if reason: text = f"@{v.username} (a site admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}" - else: text = f"@{v.username} (a site admin) has banned you for **{days_txt}** days." else: - if reason: text = f"@{v.username} (a site admin) has banned you permanently for the following reason:\n\n> {reason}" - else: text = f"@{v.username} (a site admin) has banned you permanently." + duration = "permanently" + text = f"@{v.username} (a site admin) has banned you {duration} for the following reason:\n\n> {reason}" user.ban(admin=v, reason=reason, days=days) send_repeatable_notification(user.id, text)