{% load i18n misago_capture %}
{% if category.acl.can_browse %}
  {% if not category.acl.can_see_all_threads %}
    <p class="category-thread-message">
      <span class="material-icon">
        info_outline
      </span>
      {% trans "This category is private. You can see only your own threads within it." %}
    </p>
  {% elif category.last_thread_title %}
    {% capture trimmed as thread %}
      <a href="{{ category.get_last_thread_url }}" class="item-title thread-title">{{ category.last_thread_title }}</a>
    {% endcapture %}

    {% capture trimmed as user %}
      {% if category.last_poster_id %}
        <a href="{% url 'misago:user' slug=category.last_poster_slug pk=category.last_poster_id %}" class="poster-title">{{ category.last_poster_name }}</a>
      {% else %}
        <span class="poster-title">{{ category.last_poster_name }}</span>
      {% endif %}
    {% endcapture %}

    {% capture trimmed as date %}
      <a href="{{ category.get_last_post_url }}" class="last-title" title="{{ category.last_post_on|date:'DATETIME_FORMAT' }}">{{ category.last_post_on|date }}</a>
    {% endcapture %}

    <p class="category-last-post">
      {% blocktrans trimmed with thread=thread|safe user=user|safe date=date|safe %}
      Last post in {{ thread }} by {{ user }} {{ date }}
      {% endblocktrans %}
    </p>
  {% else %}
    <p class="category-thread-message">
      <span class="material-icon">
        error_outline
      </span>
      {% trans "This category is empty." %}
    </p>
  {% endif %}
{% else %}
  <p class="category-thread-message">
    <span class="material-icon">
      highlight_off
    </span>
    {% trans "This category is protected. You can't browse it's contents." %}
  </p>
{% endif %}