1.3 KiB · text History e0979f3
{# Sanction controls for one user (`u`), swapping `#user-<id>`. Staff can't
   be sanctioned. #}
{% set swap = 'hx-target="#user-' ~ u.id ~ '" hx-select="unset" hx-swap="outerHTML"' %}
{% if u.is_staff %}
  <span class="text-xs opacity-50">staff</span>
{% else %}
<div class="flex flex-wrap items-center gap-1">
  {% if u.silenced %}
    <form hx-post="/admin/users/{{ u.id }}/end-cooldown" {{ swap | safe }} class="m-0"><input type="hidden" name="mode" value="{{ mode }}">
      <button class="btn btn-ghost btn-xs" type="submit">End cooldown</button></form>
  {% else %}
    {% with action = "cooldown", label = "Cooldown", target = u.id, post_id = none %}{% include "admin/_sanction_form.html" %}{% endwith %}
  {% endif %}
  {% if u.suspended %}
    <form hx-post="/admin/users/{{ u.id }}/unsuspend" {{ swap | safe }} class="m-0"><input type="hidden" name="mode" value="{{ mode }}">
      <button class="btn btn-ghost btn-xs" type="submit">Lift suspension</button></form>
  {% else %}
    {% with action = "suspend", label = "Suspend", target = u.id, post_id = none %}{% include "admin/_sanction_form.html" %}{% endwith %}
  {% endif %}
  {% with target = u.id, ignored = u.flags_ignored, name = u.username, swap_target = "#user-" ~ u.id, post_id = none %}{% include "admin/_shadow_form.html" %}{% endwith %}
</div>
{% endif %}