add: temporary bans

This commit is contained in:
trisua 2025-08-05 13:39:01 -04:00
parent 9650c0177e
commit 155fe34c6e
11 changed files with 132 additions and 19 deletions

View file

@ -298,7 +298,7 @@
(div
("class" "flex flex_col gap_1")
(label
("for" "title")
("for" "reason")
(str (text "mod_panel:label.ban_reason")))
(textarea
("type" "text")
@ -309,6 +309,37 @@
(text "{{ profile.ban_reason|remove_script_tags|safe }}")))
(button
(str (text "general:action.save")))))
(div
("class" "card_nest w_full")
(div
("class" "card small flex items_center justify_between gap_2")
(div
("class" "flex items_center gap_2")
(icon (text "scale"))
(span
(str (text "mod_panel:label.ban_expiration")))))
(form
("class" "card flex flex_col gap_2")
("onsubmit" "event.preventDefault(); profile_request(false, 'ban_expire', { expire: new Date(event.target.expire.value).getTime() || 0 })")
(div
("class" "flex flex_col gap_1")
(label
("for" "expire")
(str (text "mod_panel:label.ban_expiration")))
(input
("type" "datetime-local")
("name" "expire")
("id" "expire")
("value" "{{ profile.ban_expire }}")))
(div
("class" "flex gap_2")
(button
(str (text "general:action.save")))
(button
("type" "button")
("class" "lowered red")
("onclick" "profile_request(false, 'ban_expire', { expire: 0 })")
(str (text "notifs:action.clear"))))))
(div
("class" "card_nest w_full")
(div

View file

@ -76,7 +76,17 @@
(span ("class" "fade") (text "The following reason was provided by a moderator:"))
(div
("class" "card lowered w_full")
(text "{{ user.ban_reason|markdown|safe }}"))))))
(text "{{ user.ban_reason|markdown|safe }}"))
(text "{% if user.ban_expire != 0 -%}")
(hr)
(span
(text "Your ban will expire on: ")
(span ("id" "ban_expire")))
(script
(text "document.getElementById(\"ban_expire\").innerText = new Date({{ user.ban_expire }}).toLocaleString();"))
(text "{% else %}")
(span (text "This ban is marked as permanent."))
(text "{%- endif %}")))))
; if we aren't banned, just show the page body
(text "{% elif user and user.awaiting_purchase %}")
; account waiting for payment message