{% macro display_actor_inline(follower, size=50) -%} {% if follower and follower.id %} {% if not follower.icon %} {% else %} {% endif %}
{{ follower.name or follower.preferredUsername }}
@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}
{% endif %} {%- endmacro %} {% macro display_note(obj, perma=False, ui=False, likes=[], shares=[], meta={}, no_color=False) -%} {% if meta.actor %} {% set actor = meta.actor %} {% else %} {% set actor = obj.attributedTo | get_actor %} {% endif %} {% if session.logged_in %} {% set perma_id = obj.id | permalink_id %} {% if request.args.get('older_than') %} {% set redir = request.path + "?older_than=" + request.args.get('older_than') + "#activity-" + perma_id %} {% elif request.args.get('newer_than') %} {% set redir = request.path + "?newer_than=" + request.args.get('newer_than') + "#activity-" + perma_id %} {% else %} {% set redir = request.path + "#activity-" + perma_id %} {% endif %}
{{ actor.name or actor.preferredUsername }} @{% if not no_color and obj.id | is_from_outbox %}{{ actor.preferredUsername }}{% else %}{{ actor.preferredUsername }}{% endif %}@{% if not no_color and obj.id | is_from_outbox %}{{ actor | url_or_id | get_url | domain }}{% else %}{{ actor | url_or_id | get_url | domain }}{% endif %} {% if not perma %} {% endif %}
{% if obj.summary %}

{{ obj.summary | clean }}

{% endif %} {% if obj | has_type('Video') %}
{% endif %}
{% if obj | has_type('Article') %} {{ obj.name }} {{ obj | url_or_id | get_url }} {% elif obj | has_type('Question') %} {{ obj.content | clean | safe }} {% if obj.id | is_from_outbox or (meta.question_replies and (obj.closed or meta.voted_for)) %}
    {% set total_votes = meta.question_replies %} {% for oneOf in obj.oneOf %} {% set pct = 0 %} {% if total_votes > 0 %} {% set cnt = oneOf.name | get_answer_count(meta) %} {% set pct = cnt * 100.0 / total_votes %} {% endif %}
  • {{ '%0.0f'| format(pct) }}% {{ oneOf.name }}
  • {% endfor %}

{% if obj.closed or obj.endTime | gtnow %} Ended {{ obj.endTime | format_timeago }} with {{ total_votes }} vote{% if total_votes | gtone %}s{% endif %}. {% else %} Ends {{ obj.endTime | format_timeago }} ({{ total_votes }} vote{% if total_votes | gtone %}s{% endif %} as of now). {% endif %}

{% else %}
    {% for oneOf in obj.oneOf %}
  • {% if not meta.voted_for and not obj.endTime | gtnow %}
    {% else %} ??? {% endif %} {{ oneOf.name }} {% if oneOf.name == meta.voted_for %}(your vote){% endif %}
  • {% endfor %}

    {% if obj.endTime | gtnow %}This question ended {{ obj.endTime | format_timeago }}.

    {% else %}This question ends {{ obj.endTime | format_timeago }}{% endif %}

{% endif %} {% else %} {{ obj.content | clean | safe }} {% endif %}
{% if obj.attachment and obj | has_type('Note') %}
{% if obj.attachment | not_only_imgs %}

Attachments

    {% endif %} {% for a in obj.attachment %} {% if (a.mediaType and a.mediaType.startswith("image/")) or (a.type and a.type == 'Image') %} {% elif (a.mediaType and a.mediaType.startswith("video/")) %}
  • {% else %}
  • {% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}
  • {% endif %} {% endfor %} {% if obj.attachment | not_only_imgs %}
{% endif %}
{% endif %} {% if meta and meta.og_metadata and obj | has_type('Note') %} {% for og in meta.og_metadata %} {% if og.url %}
{{ og.title }}

{{ og.description | truncate(80) }}

{{ og.site_name }}
{% endif %} {% endfor %} {% endif %}
{% if perma %}{{ obj.published | format_time }} {% if not (obj.id | is_from_outbox) %} permalink {% endif %} {% else %} permalink {% endif %} {% set aid = obj.id | quote_plus %} {% endif %} {% if meta.count_reply and obj.id | is_from_outbox %}{{ meta.count_reply }} replies {% elif meta.count_reply and session.logged_in %} {{ meta.count_reply }} replies{% endif %} {% if not perma and meta.count_boost and obj.id | is_from_outbox %}{{ meta.count_boost }} boosts{% endif %} {% if not perma and meta.count_like and obj.id | is_from_outbox %}{{ meta.count_like }} likes{% endif %} {% if session.logged_in %} {% if ui%} {% if meta.boosted %}
{% else %}
{% endif %} {% if meta.liked %}
{% else %}
{% endif %} {% endif %} {% if obj.id | is_from_outbox %}
{% if meta.pinned %}
{% else %}
{% endif %} {% else %}
{% endif %} reply {% endif %}
{% if likes or shares %}
{% if likes %}

{{ likes|length }} likes

{% for like in likes %} {{ display_actor_inline(like) }} {% endfor %}
{% endif %} {% if shares %}

{{ shares|length }} boosts

{% for boost in shares %} {{ display_actor_inline(boost) }} {% endfor %}
{% endif %}
{% endif %}
{%- endmacro %} {% macro display_thread(thread, likes=[], shares=[]) -%} {% for reply in thread %} {% if reply._requested %} {{ display_note(reply.activity.object, perma=True, ui=False, likes=likes, shares=shares, meta=reply.meta) }} {% else %} {{ display_note(reply.activity.object, perma=False, ui=True, meta=reply.meta) }} {% endif %} {% endfor %} {% endmacro -%} {% macro display_pagination(older_than, newer_than) -%}
{% if older_than %} {% endif %} {% if newer_than %} {% endif %}
{% endmacro -%} {% macro display_pagination_links(older_than, newer_than) -%} {% if older_than %}{% endif %} {% if newer_than %}{% endif %} {% endmacro -%}