{% load i18n %}
{% load mastodon %}
{% current_user_relationship identity as relationship %}
{% if relationship.rejecting %}
  <span class="tag-list">
    <span><a title="{% trans "click to unblock" %}"
   hx-confirm="{% trans "are you sure to unblock?" %}"
   hx-post="{% url 'users:unblock' identity.handle %}"
   hx-target="closest .action"
   hx-swap="innerHTML">{% trans "blocked" %}</a></span>
  </span>
{% else %}
  {% if relationship.status %}
    <span class="tag-list">
      <span><a>{{ relationship.status }}</a></span>
    </span>
  {% else %}
    <span style="padding-bottom:1em;display:inline-block">&nbsp;</span>
  {% endif %}
  {% if show_home %}
    <span>
      <a title="{% trans "user profile" %}" href="{{ identity.url }}">
        <i class="fa-solid fa-home"></i>
      </a>
    </span>
  {% endif %}
  {% if identity.locked %}
    <span>
      <a title="{% trans "approving followers manually" %}">
        <i class="fa-solid fa-user-shield"></i>
      </a>
    </span>
  {% endif %}
  {% if not identity.local %}
    <span>
      <a href="{{ identity.profile_uri }}"
         target="_blank"
         rel="noopener"
         title="{% trans "original home" %}">
        <i class="fa-solid fa-circle-nodes"></i>
      </a>
    </span>
  {% else %}
    {% if identity.user.is_superuser %}
      <span>
        <a title="admin">
          <i class="fa-solid fa-user-astronaut"></i>
        </a>
      </span>
    {% elif identity.user.is_staff %}
      <span>
        <a title="staff">
          <i class="fa-solid fa-hat-wizard"></i>
        </a>
      </span>
    {% endif %}
    {% if not identity.locked or request.user.is_superuser or relationship.requested or relationship.status %}
      {% include "users/_profile_social_icons.html" %}
    {% endif %}
  {% endif %}
  {% if relationship.requested %}
    <span>
      <a title="{% trans "accept follow request" %}"
         class="activated"
         hx-confirm="{% trans 'sure to accept follow request?' %}"
         hx-post="{% url 'users:accept_follow_request' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-check"></i>
      </a>
    </span>
    <span>
      <a title="{% trans "reject follow request" %}"
         class="activated"
         hx-confirm="{% trans 'sure to reject follow request?' %}"
         hx-post="{% url 'users:reject_follow_request' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-xmark"></i>
      </a>
    </span>
  {% endif %}
  {% if relationship.following %}
    <span>
      <a title="{% trans "click to unfollow" %}"
         class="activated"
         hx-confirm="{% trans 'sure to unfollow?' %}"
         hx-post="{% url 'users:unfollow' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-user-check"></i>
      </a>
    </span>
  {% elif relationship.requesting %}
    <span>
      <a title="{% trans "click to cancel follow request" %}"
         class="activated"
         hx-confirm="{% trans 'sure to cancel follow request?' %}"
         hx-post="{% url 'users:unfollow' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-user-clock"></i>
      </a>
    </span>
  {% else %}
    <span>
      <a title="{% trans "click to follow" %}"
         hx-confirm="{% trans 'sure to follow?' %}"
         hx-post="{% url 'users:follow' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-user-plus"></i>
      </a>
    </span>
  {% endif %}
  {% if not relationship.muting %}
    <span>
      <a title="{% trans "click to mute" %}"
         hx-post="{% url 'users:mute' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-eye"></i>
      </a>
    </span>
  {% else %}
    <span>
      <a title="{% trans "click to unmute" %}"
         class="activated"
         hx-post="{% url 'users:unmute' identity.handle %}"
         hx-target="closest .action"
         hx-swap="innerHTML">
        <i class="fa-solid fa-eye-slash"></i>
      </a>
    </span>
  {% endif %}
  <span>
    <a title="{% trans 'click to block' %}"
       hx-confirm="{% trans 'sure to block?' %}"
       hx-post="{% url 'users:block' identity.handle %}"
       hx-target="closest .action"
       hx-swap="innerHTML">
      <i class="fa-solid fa-user-slash"></i>
    </a>
  </span>
{% endif %}
