fix mod log links

pull/83/head
Aevann 2022-12-30 18:10:29 +02:00
parent fa15b1fdf8
commit e0e8eb3dd6
2 changed files with 6 additions and 5 deletions

View File

@ -186,3 +186,5 @@ def command_regex_matcher(match, upper=False):
color = tuple(choices(range(256), k=3))
result = f'<b style="color:rgb{color}">Your roll: {result}</b>'
return match.group(1) + result
reason_regex = re.compile('(/(post|comment)/[0-9]+)', flags=re.A)

View File

@ -1003,11 +1003,10 @@ def ban_user(user_id, v):
if not reason:
abort(400, "You need to submit a reason for banning!")
if reason.startswith("/") and '\\' not in reason:
reason = f'<a href="{reason.split()[0]}">{reason}</a>'
reason = filter_emojis_only(reason)
reason = reason_regex.sub(r'<a href="\1">\1</a>', reason)
user.ban(admin=v, reason=reason, days=days)
if request.values.get("alts"):
@ -1071,11 +1070,11 @@ def agendaposter(user_id, v):
pass
reason = request.values.get("reason", "").strip()
if reason and reason.startswith("/") and '\\' not in reason:
reason = f'<a href="{reason.split()[0]}">{reason}</a>'
reason = filter_emojis_only(reason)
reason = reason_regex.sub(r'<a href="\1">\1</a>', reason)
duration = "permanently"
if days:
user.agendaposter = int(time.time()) + (days * 86400)