Merge pull request #103 from TheCaringCleaner/ban-links

transform post/comment links in ban reason
master
Aevann1 2021-11-24 08:02:53 -08:00 committed by GitHub
commit f33b3a33b9
2 changed files with 11 additions and 1 deletions

View File

@ -202,6 +202,12 @@ class User(Base):
def age(self):
return int(time.time()) - self.created_utc
@property
@lazy
def ban_reason_link(self):
if self.ban_reason and (self.ban_reason.startswith("/post/") or self.ban_reason.startswith("/comment/")):
return self.ban_reason.split(" ", 1)[0]
@property
@lazy
def alts_unique(self):

View File

@ -122,7 +122,11 @@
</div>
<div class="ml-3 w-100">
{% if u.is_suspended %}
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}:
{% if u.ban_reason_link %}<a href="{{ u.ban_reason_link }}"><i class="fas fa-link"></i>{% endif %}
{{ u.ban_reason }}
{% if u.ban_reason_link %}</a>{% endif %}
{% endif %}</h5>
{% if u.unban_utc %}<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>{% endif %}
{% endif %}
<div class="d-flex align-items-center mt-1 mb-2">