From 7fdf0ad348871794b45d944f14d2ea38e0a8ec9a Mon Sep 17 00:00:00 2001 From: CaringCleaner Date: Wed, 24 Nov 2021 15:33:41 +0000 Subject: [PATCH] 8=====D --- files/classes/user.py | 9 +++++++++ files/templates/userpage.html | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/files/classes/user.py b/files/classes/user.py index 1cd03df48..d5cc4dae9 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -199,6 +199,15 @@ class User(Base): def age(self): return int(time.time()) - self.created_utc + @property + @lazy + def ban_reason_link(self): + if not self.ban_reason: + return self.ban_reason + + if self.ban_reason.startswith("/post/") or self.ban_reason.startswith("/comment/"): + return self.ban_reason.split(" ", 1)[0] + @property @lazy def alts_unique(self): diff --git a/files/templates/userpage.html b/files/templates/userpage.html index d4f2533a3..184370766 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -122,7 +122,11 @@
{% if u.is_suspended %} -
BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}
+
BANNED USER{% if u.ban_reason %}: + {% if u.ban_reason_link %}{% endif %} + {{ u.ban_reason }} + {% if u.ban_reason_link %}{% endif %} + {% endif %}
{% if u.unban_utc %}
{{u.unban_string}}
{% endif %} {% endif %}