{# Generic renderer for activity streams #}
{% from "macros/user.html" import m_user_photo, m_user_link %}

{%- macro m_activities(entries, ignore_communities=False) %}
  <ul class="activities">
    {%- for entry in entries %}
      <li>
        {{ m_activity(entry) }}
      </li>
    {%- endfor %}
  </ul>
{% endmacro %}

{% macro m_activity(entry, ignore_communities=False) %}
  {% call m_user_link(entry.actor) %}
    {{ m_user_photo(entry.actor, size=45) }}
  {% endcall %}

  <div class="entry">
    <span class="datetime">{{ entry.happened_at|age }}</span>
    {%- call m_user_link(entry.actor) %}
      {{ entry.actor }}
    {%- endcall %}

    <span class="message">{{ entry.message(ignore_communities)|safe }}</span>

    {%- set body = entry.body %}
    {%- if body %}
      {{ body }}
    {%- endif %}
  </div>
{%- endmacro %}

{% macro m_actor(actor) %}
{% endmacro %}
