{% macro embed_csrf_token() %} {% block embed_csrf_token scoped %} {% endblock %} {% endmacro %} {% macro embed_redirect_url(permalink_id=None) %} {% block embed_redirect_url scoped %} {% endblock %} {% endmacro %} {% macro admin_block_button(actor) %} {% block admin_block_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url() }}
{% endblock %} {% endmacro %} {% macro admin_unblock_button(actor) %} {% block admin_unblock_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url() }}
{% endblock %} {% endmacro %} {% macro admin_follow_button(actor) %} {% block admin_follow_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url() }}
{% endblock %} {% endmacro %} {% macro admin_accept_incoming_follow_button(notif) %} {% block admin_accept_incoming_follow_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url() }}
{% endblock %} {% endmacro %} {% macro admin_reject_incoming_follow_button(notif) %} {% block admin_reject_incoming_follow_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url() }}
{% endblock %} {% endmacro %} {% macro admin_like_button(ap_object_id, permalink_id) %} {% block admin_like_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_bookmark_button(ap_object_id, permalink_id) %} {% block admin_bookmark_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_unbookmark_button(ap_object_id, permalink_id) %} {% block admin_unbookmark_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_pin_button(ap_object_id, permalink_id) %} {% block admin_pin_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_unpin_button(ap_object_id, permalink_id) %} {% block admin_unpin_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_delete_button(ap_object) %} {% block admin_delete_button scoped %}
{{ embed_csrf_token() }}
{% endblock %} {% endmacro %} {% macro admin_force_delete_button(ap_object_id, permalink_id=None) %} {% block admin_force_delete_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_announce_button(ap_object_id, permalink_id=None) %} {% block admin_announce_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_undo_button(ap_object_id, action="undo", permalink_id=None) %} {% block admin_undo_button scoped %}
{{ embed_csrf_token() }} {{ embed_redirect_url(permalink_id) }}
{% endblock %} {% endmacro %} {% macro admin_reply_button(ap_object_id) %} {% block admin_reply_button scoped %}
{% endblock %} {% endmacro %} {% macro admin_dm_button(actor_handle) %} {% block admin_dm_button scoped %}
{% endblock %} {% endmacro %} {% macro admin_mention_button(actor_handle) %} {% block admin_mention_button scoped %}
{% endblock %} {% endmacro %} {% macro admin_profile_button(ap_actor_id) %} {% block admin_profile_button scoped %}
{% endblock %} {% endmacro %} {% macro admin_expand_button(ap_object) %} {% block admin_expand_button scoped %} {# TODO turn these into a regular link and append permalink ID if it's a reply #}
{% endblock %} {% endmacro %} {% macro display_box_filters(route) %} {% block display_box_filters scoped %} {% endblock %} {% endmacro %} {% macro display_tiny_actor_icon(actor) %} {% block display_tiny_actor_icon scoped %} {{ actor.display_name }}'s avatar {% endblock %} {% endmacro %} {% macro actor_action(inbox_object, text, with_icon=False) %} {% block actor_action scoped %}
{% if with_icon %}{{ display_tiny_actor_icon(inbox_object.actor) }}{% endif %} {{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }} {{ text }} {{ inbox_object.ap_published_at | timeago }}
{% endblock %} {% endmacro %} {% macro display_actor(actor, actors_metadata={}, embedded=False, with_details=False, pending_incoming_follow_notif=None) %} {% block display_actor scoped %} {% set metadata = actors_metadata.get(actor.ap_id) %} {% if not embedded %}
{% endif %}
{{ actor.display_name }}'s avatar
{{ actor.display_name | clean_html(actor) | safe }}
{{ actor.handle }}
{% if is_admin and metadata %}
{% endif %} {% if with_details %} {% if actor.summary %}
{{ actor.summary | clean_html(actor) | safe }}
{% endif %} {% if actor.attachments %}
{% for prop in actor.attachments %}
{% if prop.type == "PropertyValue" %}
{{ prop.name }}
{{ prop.value | clean_html(actor) | safe }}
{% endif %}
{% endfor %}
{% endif %} {% endif %} {% if not embedded %}
{% endif %} {% endblock %} {% endmacro %} {% macro display_og_meta(object) %} {% block display_og_meta scoped %} {% if object.og_meta %} {% for og_meta in object.og_meta[:1] %}
{% if og_meta.image %}
{% endif %}
{{ og_meta.title }} {% if og_meta.site_name %} {{ og_meta.site_name }} {% endif %}
{% endfor %} {% endif %} {% endblock %} {% endmacro %} {% macro display_attachments(object) %} {% block display_attachments scoped %} {% for attachment in object.attachments %} {% if attachment.type != "PropertyValue" %} {% set orientation = "unknown" %} {% if attachment.width %} {% set orientation = "portrait" if attachment.width < attachment.height else "landscape" %} {% endif %} {% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %}
{% else %}
{% endif %} {% if attachment.type == "Image" or (attachment | has_media_type("image")) %} {% if attachment.url not in object.inlined_images %} {{ attachment.name }} {% endif %} {% elif attachment.type == "Video" or (attachment | has_media_type("video")) %} {% elif attachment.type == "Audio" or (attachment | has_media_type("audio")) %} {% elif attachment.type == "Link" %} {{ attachment.url | truncate(64, True) }} ({{ attachment.mimetype}}) {% else %} {% if attachment.name %}{{ attachment.name }}{% else %}{{ attachment.url | truncate(64, True) }}{% endif %} ({{ attachment.mimetype }}) {% endif %} {% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %}
{% else %}
{% endif %} {% endif %} {% endfor %} {% endblock %} {% endmacro %} {% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False) %} {% block display_object scoped %} {% set is_article_mode = object.is_from_outbox and object.ap_type == "Article" and is_object_page %} {% if object.ap_type in ["Note", "Article", "Video", "Page", "Question", "Event"] %}
{% if is_article_mode %} {% else %} {{ display_actor(object.actor, actors_metadata, embedded=True) }} {% endif %} {% if object.in_reply_to %}

in reply to this {{ object.ap_type|lower }}

{% endif %} {% if object.ap_type in ["Article", "Event"] %}

{{ object.name }}

{% endif %} {% if object.ap_type == "Event" %} {% if object.ap_object.get("endTime") and object.ap_object.get("startTime") %}

On {{ object.ap_object.startTime | parse_datetime | format_date }} (ends {{ object.ap_object.endTime | parse_datetime | format_date }})

{% endif %} {% endif %} {% if object.ap_object.get("location") %} {% set loc = object.ap_object.get("location") %} {% if loc.type == "Place" and loc.latitude and loc.longitude %}

Location

{% if loc.name %}{{ loc.name }}{% endif %} {{loc.latitude}},{{loc.longitude}}
{% endif %} {% endif %} {% if is_article_mode %} {% endif %} {% if object.summary %}

{{ object.summary | clean_html(object) | safe }}

{% endif %}
{{ object.content | clean_html(object) | safe }}
{% if object.ap_type == "Question" %} {% set can_vote = is_admin and object.is_from_inbox and not object.is_poll_ended and not object.voted_for_answers %} {% if can_vote %}
{{ embed_csrf_token() }} {{ embed_redirect_url(object.permalink_id) }} {% endif %} {% if object.poll_items %}
    {% for item in object.poll_items %}
  • {% set pct = item | poll_item_pct(object.poll_voters_count) %}

    {% if can_vote %} {% endif %} {{ pct }}% ({{ item.replies.totalItems }} votes)

  • {% endfor %}
{% endif %} {% if can_vote %}

{% endif %} {% endif %} {{ display_og_meta(object) }}
{% if object.summary %}
{% endif %}
{{ display_attachments(object) }}
{% if is_admin %} {% endif %} {% if likes or shares or webmentions %}
{% if likes %}
Likes
{% for like in likes %} {{ like.actor.handle}} {% endfor %} {% if object.likes_count > likes | length %}
and {{ object.likes_count - likes | length }} more.
{% endif %}
{% endif %} {% if shares %}
Shares
{% for share in shares %} {{ share.actor.handle}} {% endfor %} {% if object.announces_count > shares | length %}
and {{ object.announces_count - shares | length }} more.
{% endif %}
{% endif %} {% if webmentions %}
Webmentions
{% for webmention in webmentions %} {% set wm = webmention.as_facepile_item %} {% if wm %} {{ wm.actor_name }} {% endif %} {% endfor %}
{% endif %}
{% endif %}
{% endif %} {% endblock %} {% endmacro %}