2022-06-22 13:11:22 -05:00
{% macro embed_csrf_token() %}
2022-11-05 05:04:21 -05:00
{% block embed_csrf_token scoped %}
2022-06-22 13:11:22 -05:00
< input type = "hidden" name = "csrf_token" value = "{{ csrf_token }}" >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro embed_redirect_url(permalink_id=None) %}
2022-11-05 05:04:21 -05:00
{% block embed_redirect_url scoped %}
2022-07-15 13:01:55 -05:00
< input type = "hidden" name = "redirect_url" value = "{{ request.url }}{% if permalink_id %}#{{ permalink_id }}{% endif %}" >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-07-31 03:35:11 -05:00
{% macro admin_block_button(actor) %}
2022-11-05 05:04:21 -05:00
{% block admin_block_button scoped %}
2022-07-31 03:35:11 -05:00
< form action = "{{ request.url_for(" admin_actions_block " ) } } " method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url() }}
< input type = "hidden" name = "ap_actor_id" value = "{{ actor.ap_id }}" >
< input type = "submit" value = "block" >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-07-31 03:35:11 -05:00
{% endmacro %}
{% macro admin_unblock_button(actor) %}
2022-11-05 05:04:21 -05:00
{% block admin_unblock_button scoped %}
2022-07-31 03:35:11 -05:00
< form action = "{{ request.url_for(" admin_actions_unblock " ) } } " method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url() }}
< input type = "hidden" name = "ap_actor_id" value = "{{ actor.ap_id }}" >
< input type = "submit" value = "unblock" >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-07-31 03:35:11 -05:00
{% endmacro %}
2022-06-22 13:11:22 -05:00
{% macro admin_follow_button(actor) %}
2022-11-05 05:04:21 -05:00
{% block admin_follow_button scoped %}
2022-06-22 13:11:22 -05:00
< form action = "{{ request.url_for(" admin_actions_follow " ) } } " method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url() }}
< input type = "hidden" name = "ap_actor_id" value = "{{ actor.ap_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "follow" >
2022-06-22 13:11:22 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-08-02 13:14:40 -05:00
{% macro admin_accept_incoming_follow_button(notif) %}
2022-11-05 05:04:21 -05:00
{% block admin_accept_incoming_follow_button scoped %}
2022-08-02 13:14:40 -05:00
< form action = "{{ request.url_for(" admin_actions_accept_incoming_follow " ) } } " method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url() }}
< input type = "hidden" name = "notification_id" value = "{{ notif.id }}" >
< input type = "submit" value = "accept follow" >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-08-02 13:14:40 -05:00
{% endmacro %}
{% macro admin_reject_incoming_follow_button(notif) %}
2022-11-05 05:04:21 -05:00
{% block admin_reject_incoming_follow_button scoped %}
2022-08-02 13:14:40 -05:00
< form action = "{{ request.url_for(" admin_actions_reject_incoming_follow " ) } } " method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url() }}
< input type = "hidden" name = "notification_id" value = "{{ notif.id }}" >
< input type = "submit" value = "reject follow" >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-08-02 13:14:40 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro admin_like_button(ap_object_id, permalink_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_like_button scoped %}
2022-06-22 13:11:22 -05:00
< form action = "{{ request.url_for(" admin_actions_like " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-22 13:11:22 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "like" >
2022-06-22 13:11:22 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro admin_bookmark_button(ap_object_id, permalink_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_bookmark_button scoped %}
2022-06-26 04:09:43 -05:00
< form action = "{{ request.url_for(" admin_actions_bookmark " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-26 04:09:43 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "bookmark" >
2022-06-26 04:09:43 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-26 04:09:43 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro admin_unbookmark_button(ap_object_id, permalink_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_unbookmark_button scoped %}
2022-06-26 04:09:43 -05:00
< form action = "{{ request.url_for(" admin_actions_unbookmark " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-26 04:09:43 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "unbookmark" >
2022-06-26 04:09:43 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-26 04:09:43 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro admin_pin_button(ap_object_id, permalink_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_pin_button scoped %}
2022-06-26 11:07:55 -05:00
< form action = "{{ request.url_for(" admin_actions_pin " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-26 11:07:55 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "pin" >
2022-06-26 11:07:55 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-26 11:07:55 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro admin_unpin_button(ap_object_id, permalink_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_unpin_button scoped %}
2022-06-26 11:07:55 -05:00
< form action = "{{ request.url_for(" admin_actions_unpin " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-26 11:07:55 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "unpin" >
2022-06-26 11:07:55 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-26 11:07:55 -05:00
{% endmacro %}
2022-08-30 12:09:51 -05:00
{% macro admin_delete_button(ap_object) %}
2022-11-05 05:04:21 -05:00
{% block admin_delete_button scoped %}
2022-08-29 13:11:31 -05:00
< form action = "{{ request.url_for(" admin_actions_delete " ) } } " class = "object-delete-form" method = "POST" >
2022-07-02 03:33:20 -05:00
{{ embed_csrf_token() }}
2022-09-07 12:45:34 -05:00
< input type = "hidden" name = "redirect_url" value = "{% if request.url.path.endswith(" / " + ap_object . public_id ) or ( request . url . path = = " / admin / object " and request . query_params . ap_id . endswith ( " / " + ap_object . public_id ) ) % } { { request . base_url } } { % else % } { { request . url } } { % endif % } " >
2022-08-30 12:09:51 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object.ap_id }}" >
2022-07-03 15:01:47 -05:00
< input type = "submit" value = "delete" >
2022-07-02 03:33:20 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-07-02 03:33:20 -05:00
{% endmacro %}
2022-11-13 11:19:52 -06:00
{% macro admin_force_delete_button(ap_object_id, permalink_id=None) %}
{% block admin_force_delete_button scoped %}
< form action = "{{ request.url_for(" admin_actions_force_delete " ) } } " class = "object-delete-form" method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url(permalink_id) }}
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
< input type = "submit" value = "local delete" >
< / form >
{% endblock %}
{% endmacro %}
2022-08-12 03:01:35 -05:00
{% macro admin_announce_button(ap_object_id, permalink_id=None) %}
2022-11-05 05:04:21 -05:00
{% block admin_announce_button scoped %}
2022-06-22 13:11:22 -05:00
< form action = "{{ request.url_for(" admin_actions_announce " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-22 13:11:22 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
2022-08-12 03:01:35 -05:00
< input type = "submit" value = "share" >
2022-06-22 13:11:22 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-07-15 13:01:55 -05:00
{% macro admin_undo_button(ap_object_id, action="undo", permalink_id=None) %}
2022-11-05 05:04:21 -05:00
{% block admin_undo_button scoped %}
2022-06-22 13:11:22 -05:00
< form action = "{{ request.url_for(" admin_actions_undo " ) } } " method = "POST" >
{{ embed_csrf_token() }}
2022-07-15 13:01:55 -05:00
{{ embed_redirect_url(permalink_id) }}
2022-06-22 13:11:22 -05:00
< input type = "hidden" name = "ap_object_id" value = "{{ ap_object_id }}" >
< input type = "submit" value = "{{ action }}" >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-06-24 04:33:05 -05:00
{% macro admin_reply_button(ap_object_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_reply_button scoped %}
2022-11-04 02:34:05 -05:00
< form action = "{{ BASE_URL }}/admin/new" method = "GET" >
2022-06-24 04:33:05 -05:00
< input type = "hidden" name = "in_reply_to" value = "{{ ap_object_id }}" >
2022-07-03 15:01:47 -05:00
< button type = "submit" > reply< / button >
2022-06-24 04:33:05 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-24 04:33:05 -05:00
{% endmacro %}
2022-08-11 13:48:20 -05:00
{% macro admin_dm_button(actor_handle) %}
2022-11-05 05:04:21 -05:00
{% block admin_dm_button scoped %}
2022-11-04 02:34:05 -05:00
< form action = "{{ BASE_URL }}/admin/new" method = "GET" >
2022-08-11 13:48:20 -05:00
< input type = "hidden" name = "with_content" value = "{{ actor_handle }}" >
< input type = "hidden" name = "with_visibility" value = "DIRECT" >
< button type = "submit" > direct message< / button >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-08-11 13:48:20 -05:00
{% endmacro %}
{% macro admin_mention_button(actor_handle) %}
2022-11-05 05:04:21 -05:00
{% block admin_mention_button scoped %}
2022-11-04 02:34:05 -05:00
< form action = "{{ BASE_URL }}/admin/new" method = "GET" >
2022-08-11 13:48:20 -05:00
< input type = "hidden" name = "with_content" value = "{{ actor_handle }}" >
< button type = "submit" > mention< / button >
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-08-11 13:48:20 -05:00
{% endmacro %}
2022-06-25 05:19:12 -05:00
{% macro admin_profile_button(ap_actor_id) %}
2022-11-05 05:04:21 -05:00
{% block admin_profile_button scoped %}
2022-06-25 05:19:12 -05:00
< form action = "{{ url_for(" admin_profile " ) } } " method = "GET" >
< input type = "hidden" name = "actor_id" value = "{{ ap_actor_id }}" >
2022-07-03 15:01:47 -05:00
< button type = "submit" > profile< / button >
2022-06-25 05:19:12 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-25 05:19:12 -05:00
{% endmacro %}
2022-08-27 02:45:14 -05:00
{% macro admin_expand_button(ap_object) %}
2022-11-05 05:04:21 -05:00
{% block admin_expand_button scoped %}
2022-08-27 02:45:14 -05:00
{# TODO turn these into a regular link and append permalink ID if it's a reply #}
2022-06-25 05:29:35 -05:00
< form action = "{{ url_for(" admin_object " ) } } " method = "GET" >
2022-08-27 02:45:14 -05:00
< input type = "hidden" name = "ap_id" value = "{{ ap_object.ap_id }}" >
2022-07-03 15:01:47 -05:00
< button type = "submit" > expand< / button >
2022-06-25 05:29:35 -05:00
< / form >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-25 05:29:35 -05:00
{% endmacro %}
2022-06-28 13:10:25 -05:00
{% macro display_box_filters(route) %}
2022-11-05 05:04:21 -05:00
{% block display_box_filters scoped %}
2022-07-09 01:15:33 -05:00
< nav class = "flexbox box" >
2022-07-03 15:01:47 -05:00
< ul >
< li > Filter by< / li >
2022-07-25 14:48:40 -05:00
{% for ap_type in ["Note", "Article", "Page", "Question", "Like", "Announce", "Follow"] %}
2022-07-03 15:01:47 -05:00
< li > < a href = "{{ url_for(route) }}?filter_by={{ ap_type }}" { % if request . query_params . filter_by = = ap_type % } class = "active" { % endif % } >
{{ ap_type }}
< / a >
< / li >
{% endfor %}
{% if request.query_params.filter_by %}
< li >
< a href = "{{ url_for(route) }}" > Reset filter< / a >
< / li >
{% endif %}
2022-07-09 01:15:33 -05:00
< / ul >
2022-07-03 15:01:47 -05:00
< / nav >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-28 13:10:25 -05:00
{% endmacro %}
2022-08-26 00:43:39 -05:00
{% macro display_tiny_actor_icon(actor) %}
2022-11-05 05:04:21 -05:00
{% block display_tiny_actor_icon scoped %}
2022-08-26 00:43:39 -05:00
< img class = "tiny-actor-icon" src = "{{ actor.resized_icon_url }}" alt = "{{ actor.display_name }}'s avatar" >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-08-26 00:43:39 -05:00
{% endmacro %}
2022-08-26 00:57:10 -05:00
{% macro actor_action(inbox_object, text, with_icon=False) %}
2022-11-05 05:04:21 -05:00
{% block actor_action scoped %}
2022-07-27 11:56:14 -05:00
< div class = "actor-action" >
2022-08-26 00:43:39 -05:00
< a href = "{{ url_for(" admin_profile " ) } } ? actor_id = {{ inbox_object . actor . ap_id } } " >
2022-08-26 00:57:10 -05:00
{% if with_icon %}{{ display_tiny_actor_icon(inbox_object.actor) }}{% endif %} {{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }}
2022-08-26 00:43:39 -05:00
< / a > {{ text }}
2022-07-31 08:00:06 -05:00
< span title = "{{ inbox_object.ap_published_at.isoformat() }}" > {{ inbox_object.ap_published_at | timeago }}< / span >
2022-07-27 11:56:14 -05:00
< / div >
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-07-27 11:56:14 -05:00
{% endmacro %}
2022-08-02 13:14:40 -05:00
{% macro display_actor(actor, actors_metadata={}, embedded=False, with_details=False, pending_incoming_follow_notif=None) %}
2022-11-05 05:04:21 -05:00
{% block display_actor scoped %}
2022-06-22 13:11:22 -05:00
{% set metadata = actors_metadata.get(actor.ap_id) %}
2022-07-09 01:15:33 -05:00
{% if not embedded %}
< div class = "ap-object" >
{% endif %}
2022-07-01 12:35:34 -05:00
< div class = "actor-box h-card p-author" >
< div class = "icon-box" >
2022-07-16 00:48:24 -05:00
< img src = "{{ actor.resized_icon_url }}" alt = "{{ actor.display_name }}'s avatar" class = "actor-icon u-photo" >
2022-06-22 13:11:22 -05:00
< / div >
2022-08-29 14:42:54 -05:00
< a href = "{{ actor.url }}" class = "u-url" >
2022-06-26 11:07:55 -05:00
< div > < strong > {{ actor.display_name | clean_html(actor) | safe }}< / strong > < / div >
2022-07-01 12:35:34 -05:00
< div class = "actor-handle p-name" > {{ actor.handle }}< / div >
2022-06-22 13:11:22 -05:00
< / a >
< / div >
2022-07-27 12:36:55 -05:00
2022-06-25 03:20:07 -05:00
{% if is_admin and metadata %}
2022-06-22 13:11:22 -05:00
< div >
2022-07-03 15:01:47 -05:00
< nav class = "flexbox actor-metadata" >
2022-07-09 01:15:33 -05:00
< ul >
2022-10-18 14:39:09 -05:00
{% if metadata.has_blocked_local_actor %}
< li > blocked you< / li >
{% endif %}
2022-06-25 03:20:07 -05:00
{% if metadata.is_following %}
< li > already following< / li >
2022-07-03 15:01:47 -05:00
< li > {{ admin_undo_button(metadata.outbox_follow_ap_id, "unfollow")}}< / li >
2022-09-21 14:00:17 -05:00
{% if not with_details %}
< li > {{ admin_profile_button(actor.ap_id) }}< / li >
{% endif %}
2022-06-25 03:20:07 -05:00
{% elif metadata.is_follow_request_sent %}
2022-10-18 14:39:09 -05:00
{% if metadata.is_follow_request_rejected %}
< li > follow request rejected< / li >
{% if not metadata.has_blocked_local_actor %}
< li > {{ admin_follow_button(actor) }}< / li >
{% endif %}
{% else %}
< li > follow request sent< / li >
< li > {{ admin_undo_button(metadata.outbox_follow_ap_id, "undo follow") }}< / li >
{% endif %}
2022-09-07 14:29:09 -05:00
{% elif not actor.moved_to %}
2022-06-25 03:20:07 -05:00
< li > {{ admin_follow_button(actor) }}< / li >
2022-06-22 13:11:22 -05:00
{% endif %}
2022-06-25 03:20:07 -05:00
{% if metadata.is_follower %}
< li > follows you< / li >
2022-08-11 13:48:20 -05:00
{% if not metadata.is_following and not with_details %}
2022-07-09 01:15:33 -05:00
< li > {{ admin_profile_button(actor.ap_id) }}< / li >
2022-07-08 02:01:25 -05:00
{% endif %}
2022-09-21 12:35:48 -05:00
{% elif actor.is_from_db and not with_details and not metadata.is_following %}
2022-09-07 14:29:09 -05:00
< li > {{ admin_profile_button(actor.ap_id) }}< / li >
{% endif %}
{% if actor.moved_to %}
< li > has moved to {% if metadata.moved_to %}< a href = "{{ url_for(" admin_profile " ) } } ? actor_id = {{ actor . moved_to } } " > {{ metadata.moved_to.handle }}< / a > {% else %}< a href = "{{ url_for(" get_lookup " ) } } ? query = {{ actor . moved_to } } " > {{ actor.moved_to }}< / a > {% endif %}< / li >
2022-06-22 13:11:22 -05:00
{% endif %}
2022-07-31 03:35:11 -05:00
{% if actor.is_from_db %}
{% if actor.is_blocked %}
< li > blocked< / li >
< li > {{ admin_unblock_button(actor) }}< / li >
{% else %}
< li > {{ admin_block_button(actor) }}< / li >
{% endif %}
{% endif %}
2022-08-11 13:48:20 -05:00
< li > {{ admin_dm_button(actor.handle) }}< / li >
< li > {{ admin_mention_button(actor.handle) }}< / li >
2022-08-02 13:14:40 -05:00
{% if pending_incoming_follow_notif %}
{% if not pending_incoming_follow_notif.is_accepted and not pending_incoming_follow_notif.is_rejected %}
< li >
{{ admin_accept_incoming_follow_button(pending_incoming_follow_notif) }}
< / li >
< li >
{{ admin_reject_incoming_follow_button(pending_incoming_follow_notif) }}
< / li >
{% elif pending_incoming_follow_notif.is_accepted %}
< li > accepted< / li >
{% else %}
< li > rejected< / li >
{% endif %}
{% endif %}
2022-09-21 14:00:17 -05:00
{% if with_details %}
< li > < a href = "{{ actor.url }}" class = "label-btn" > remote profile< / a > < / li >
{% endif %}
2022-07-09 01:15:33 -05:00
< / ul >
2022-06-22 13:11:22 -05:00
< / nav >
< / div >
{% endif %}
2022-07-31 03:03:45 -05:00
{% if with_details %}
{% if actor.summary %}
< div class = "p-note" >
{{ actor.summary | clean_html(actor) | safe }}
< / div >
{% endif %}
{% if actor.attachments %}
< div id = "profile-props" >
2022-08-10 01:58:18 -05:00
{% for prop in actor.attachments %}
< dl >
2022-07-31 03:03:45 -05:00
{% if prop.type == "PropertyValue" %}
2022-08-10 01:58:18 -05:00
< dt class = "muted" title = "{{ prop.name }}" > {{ prop.name }}< / dt >
< dd > {{ prop.value | clean_html(actor) | safe }}< / dd >
2022-07-31 03:03:45 -05:00
{% endif %}
2022-08-10 01:58:18 -05:00
< / dl >
{% endfor %}
2022-07-31 03:03:45 -05:00
< / div >
{% endif %}
{% endif %}
2022-07-09 01:15:33 -05:00
{% if not embedded %}
< / div >
{% endif %}
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-22 13:11:22 -05:00
{% endmacro %}
2022-06-29 14:38:13 -05:00
{% macro display_og_meta(object) %}
2022-11-05 05:04:21 -05:00
{% block display_og_meta scoped %}
2022-06-29 14:38:13 -05:00
{% if object.og_meta %}
2022-09-20 13:15:59 -05:00
{% for og_meta in object.og_meta[:1] %}
2022-08-29 14:42:54 -05:00
< div class = "activity-og-meta" >
2022-06-29 14:38:13 -05:00
{% if og_meta.image %}
< div >
2022-08-29 14:42:54 -05:00
< img src = "{{ og_meta.image | media_proxy_url }}" >
2022-06-29 14:38:13 -05:00
< / div >
2022-08-02 15:22:15 -05:00
{% endif %}
2022-06-29 14:38:13 -05:00
< div >
2022-08-04 12:11:14 -05:00
< a href = "{{ og_meta.url | privacy_replace_url }}" > {{ og_meta.title }}< / a >
2022-07-31 08:27:12 -05:00
{% if og_meta.site_name %}
2022-08-29 14:42:54 -05:00
< small > {{ og_meta.site_name }}< / small >
2022-07-31 08:27:12 -05:00
{% endif %}
2022-06-29 14:38:13 -05:00
< / div >
< / div >
{% endfor %}
{% endif %}
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-29 14:38:13 -05:00
{% endmacro %}
2022-06-28 14:10:22 -05:00
{% macro display_attachments(object) %}
2022-11-05 05:04:21 -05:00
{% block display_attachments scoped %}
2022-06-28 14:10:22 -05:00
{% for attachment in object.attachments %}
2022-11-07 13:35:23 -06:00
{% if attachment.type != "PropertyValue" %}
2022-11-10 16:46:03 -06:00
{% set orientation = "unknown" %}
2022-11-11 07:56:56 -06:00
{% if attachment.width %}
2022-11-10 16:46:03 -06:00
{% set orientation = "portrait" if attachment.width < attachment.height else " landscape " % }
{% endif %}
2022-08-13 08:20:56 -05:00
{% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %}
2022-08-29 14:42:54 -05:00
< div class = "attachment-wrapper" >
< label for = "{{attachment.proxied_url}}" class = "label-btn show-hide-sensitive-btn" > show/hide sensitive content< / label >
2022-08-13 08:20:56 -05:00
< div >
< div class = "sensitive-attachment" >
< input class = "sensitive-attachment-state" type = "checkbox" id = "{{attachment.proxied_url}}" aria-hidden = "true" >
2022-11-11 07:56:56 -06:00
< div class = "sensitive-attachment-box attachment-orientation-{{orientation}}" >
2022-08-13 08:20:56 -05:00
< div > < / div >
{% else %}
2022-11-11 07:56:56 -06:00
< div class = "attachment-item attachment-orientation-{{orientation}}" >
2022-08-13 08:20:56 -05:00
{% endif %}
2022-06-28 14:10:22 -05:00
{% if attachment.type == "Image" or (attachment | has_media_type("image")) %}
2022-08-03 12:54:11 -05:00
{% if attachment.url not in object.inlined_images %}
2022-11-14 14:23:41 -06:00
< a class = "media-link" href = "{{ attachment.proxied_url }}" target = "_blank" >
2022-08-29 14:42:54 -05:00
< img src = "{{ attachment.resized_url or attachment.proxied_url }}" { % if attachment . name % } title = "{{ attachment.name }}" alt = "{{ attachment.name }}" { % endif % } class = "attachment" >
2022-11-14 14:23:41 -06:00
< / a >
2022-08-03 12:54:11 -05:00
{% endif %}
2022-06-28 14:10:22 -05:00
{% elif attachment.type == "Video" or (attachment | has_media_type("video")) %}
2022-08-13 08:20:56 -05:00
< video controls preload = "metadata" src = "{{ attachment.url | media_proxy_url }}" { % if attachment . name % } title = "{{ attachment.name }}" { % endif % } > < / video >
2022-06-28 14:10:22 -05:00
{% elif attachment.type == "Audio" or (attachment | has_media_type("audio")) %}
2022-08-29 14:42:54 -05:00
< audio controls preload = "metadata" src = "{{ attachment.url | media_proxy_url }}" { % if attachment . name % } title = "{{ attachment.name }}" { % endif % } class = "attachment" > < / audio >
2022-07-20 13:59:29 -05:00
{% elif attachment.type == "Link" %}
2022-09-30 02:07:07 -05:00
< a href = "{{ attachment.url }}" class = "attachment" > {{ attachment.url | truncate(64, True) }}< / a > ({{ attachment.mimetype}})
2022-06-28 14:10:22 -05:00
{% else %}
2022-09-30 02:07:07 -05:00
< a href = "{{ attachment.url | media_proxy_url }}" { % if attachment . name % } title = "{{ attachment.url }}" { % endif % } class = "attachment" >
{% if attachment.name %}{{ attachment.name }}{% else %}{{ attachment.url | truncate(64, True) }}{% endif %}
< / a > ({{ attachment.mimetype }})
2022-06-28 14:10:22 -05:00
{% endif %}
2022-09-30 02:07:07 -05:00
{% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %}
2022-08-13 08:20:56 -05:00
< / div >
< / div >
< / div >
< / div >
{% else %}
< / div >
{% endif %}
2022-11-07 13:35:23 -06:00
{% endif %}
2022-06-28 14:10:22 -05:00
{% endfor %}
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-28 14:10:22 -05:00
{% endmacro %}
2022-11-18 13:20:58 -06:00
{% macro display_webmention_reply(wm_reply) %}
{% block display_webmention_reply scoped %}
{{ wm_reply }}
{% endblock %}
{% endmacro %}
2022-07-25 15:51:53 -05:00
{% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False) %}
2022-11-05 05:04:21 -05:00
{% block display_object scoped %}
2022-07-25 15:51:53 -05:00
{% set is_article_mode = object.is_from_outbox and object.ap_type == "Article" and is_object_page %}
2022-11-07 13:35:23 -06:00
{% if object.ap_type in ["Note", "Article", "Video", "Page", "Question", "Event"] %}
2022-07-09 01:15:33 -05:00
< div class = "ap-object {% if expanded %}ap-object-expanded {% endif %}h-entry" id = "{{ object.permalink_id }}" >
2022-07-25 15:51:53 -05:00
{% if is_article_mode %}
< data class = "h-card" >
< data class = "u-photo" value = "{{ local_actor.icon_url }}" > < / data >
< data class = "u-url" value = "{{ local_actor.url}}" > < / data >
< data class = "p-name" value = "{{ local_actor.handle }}" > < / data >
< / data >
{% else %}
2022-07-14 12:05:45 -05:00
{{ display_actor(object.actor, actors_metadata, embedded=True) }}
2022-07-25 15:51:53 -05:00
{% endif %}
2022-07-09 01:15:33 -05:00
{% if object.in_reply_to %}
2022-10-03 13:05:06 -05:00
< p class = "in-reply-to" > in reply to < a href = "{% if is_admin and object.is_in_reply_to_from_inbox %}{{ url_for(" get_lookup " ) } } ? query = {% endif % } { { object . in_reply_to } } " title = "{{ object.in_reply_to }}" rel = "nofollow" >
2022-09-29 22:39:47 -05:00
this {{ object.ap_type|lower }}
< / a > < / p >
2022-07-07 14:18:20 -05:00
{% endif %}
2022-06-29 15:20:15 -05:00
2022-11-07 13:35:23 -06:00
{% if object.ap_type in ["Article", "Event"] %}
2022-08-29 14:42:54 -05:00
< h2 class = "p-name no-margin-top" > {{ object.name }}< / h2 >
2022-07-25 15:51:53 -05:00
{% endif %}
2022-11-07 13:35:23 -06:00
{% if object.ap_type == "Event" %}
{% if object.ap_object.get("endTime") and object.ap_object.get("startTime") %}
< p > On {{ object.ap_object.startTime | parse_datetime | format_date }}
(ends {{ object.ap_object.endTime | parse_datetime | format_date }})< / p >
{% 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 %}
< div class = "ap-place" >
< h3 > Location< / h3 >
{% if loc.name %}{{ loc.name }}{% endif %}
< span class = "h-geo" >
< data class = "p-latitude" value = "{{ loc.latitude}}" > < / data >
< data class = "p-longitude" value = "{{ loc.longitude }}" > < / data >
< a href = "https://www.openstreetmap.org/?mlat={{ loc.latitude }}&mlon={{ loc.longitude }}#map=16/{{loc.latitude}}/{{loc.longitude}}" > {{loc.latitude}},{{loc.longitude}}< / a >
< / span >
< / div >
{% endif %}
{% endif %}
2022-07-25 15:51:53 -05:00
{% if is_article_mode %}
< time class = "dt-published muted" datetime = "{{ object.ap_published_at.replace(microsecond=0).isoformat() }}" title = "{{ object.ap_published_at.replace(microsecond=0).isoformat() }}" > {{ object.ap_published_at.strftime("%b %d, %Y") }}< / time >
{% endif %}
2022-07-09 01:15:33 -05:00
{% if object.summary %}
2022-08-13 08:20:56 -05:00
< div class = "show-more-wrapper" >
< div class = "p-summary" >
< p > {{ object.summary | clean_html(object) | safe }}< / p >
< / div >
< label for = "show-more-{{ object.permalink_id }}" class = "show-more-btn" > show/hide more< / label >
< input class = "show-more-state" type = "checkbox" aria-hidden = "true" id = "show-more-{{ object.permalink_id }}" checked >
2022-07-09 01:15:33 -05:00
{% endif %}
2022-08-13 08:20:56 -05:00
< div class = "obj-content" >
2022-07-09 01:15:33 -05:00
< div class = "e-content" >
{{ object.content | clean_html(object) | safe }}
< / div >
2022-08-13 08:20:56 -05:00
{% if object.ap_type == "Question" %}
2022-07-23 16:09:28 -05:00
{% 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 %}
2022-07-23 12:02:06 -05:00
< form action = "{{ request.url_for(" admin_actions_vote " ) } } " method = "POST" >
{{ embed_csrf_token() }}
{{ embed_redirect_url(object.permalink_id) }}
< input type = "hidden" name = "in_reply_to" value = "{{ object.ap_id }}" >
{% endif %}
2022-07-22 11:55:24 -05:00
2022-07-23 16:06:30 -05:00
{% if object.poll_items %}
2022-08-29 14:42:54 -05:00
< ul class = "poll-items" >
2022-07-23 16:06:30 -05:00
{% for item in object.poll_items %}
2022-08-29 14:42:54 -05:00
< li >
2022-07-31 11:40:52 -05:00
{% set pct = item | poll_item_pct(object.poll_voters_count) %}
2022-08-29 14:42:54 -05:00
< p >
2022-07-23 16:06:30 -05:00
{% if can_vote %}
< input type = "{% if object.is_one_of_poll %}radio{% else %}checkbox{% endif %}" name = "name" value = "{{ item.name }}" id = "{{object.permalink_id}}-{{item.name}}" >
< label for = "{{object.permalink_id}}-{{item.name}}" >
2022-07-23 12:02:06 -05:00
{% endif %}
2022-07-23 16:06:30 -05:00
{{ item.name | clean_html(object) | safe }}
{% if object.voted_for_answers and item.name in object.voted_for_answers %}
2022-08-29 14:42:54 -05:00
< span class = "muted poll-vote" > you voted for this answer< / span >
2022-07-23 16:06:30 -05:00
{% endif %}
{% if can_vote %}
< / label >
{% endif %}
2022-08-29 14:42:54 -05:00
< span class = "float-right" > {{ pct }}% < span class = "muted" > ({{ item.replies.totalItems }} votes)< / span > < / span >
2022-07-23 12:02:06 -05:00
< / p >
2022-07-22 11:55:24 -05:00
< svg class = "poll-bar" >
2022-08-29 14:42:54 -05:00
< line x1 = "0" y1 = "10px" x2 = "{{ pct or 1 }}%" y2 = "10px" > < / line >
2022-07-22 11:55:24 -05:00
< / svg >
< / li >
{% endfor %}
< / ul >
{% endif %}
2022-07-23 16:06:30 -05:00
{% if can_vote %}
2022-07-23 12:02:06 -05:00
< p class = "form" >
< input type = "submit" value = "vote" >
< / p >
< / form >
{% endif %}
2022-07-22 11:55:24 -05:00
{% endif %}
2022-09-20 13:15:59 -05:00
{{ display_og_meta(object) }}
2022-08-13 08:20:56 -05:00
< / div >
{% if object.summary %}
< / div >
{% endif %}
2022-07-09 01:15:33 -05:00
2022-08-29 14:42:54 -05:00
< div class = "activity-attachment" >
2022-07-09 01:15:33 -05:00
{{ display_attachments(object) }}
2022-06-29 15:20:15 -05:00
< / div >
2022-07-09 01:15:33 -05:00
< nav class = "flexbox activity-bar" >
< ul >
< li >
2022-07-19 13:54:10 -05:00
< div > < a href = "{{ object.url }}" { % if object . is_from_inbox % } rel = "nofollow" { % endif % } class = "object-permalink u-url u-uid" > permalink< / a > < / div >
2022-07-14 11:40:38 -05:00
< / li >
2022-09-23 13:09:05 -05:00
{% if object.is_from_outbox and is_object_page and not is_admin and not request.url.path.startswith("/remote_interaction") %}
< li >
< a class = "label-btn" href = "{{ request.url_for(" remote_interaction " ) } } ? ap_id = {{ object . ap_id } } " >
interact from your instance
< / a >
< / li >
{% endif %}
2022-07-25 15:51:53 -05:00
{% if not is_article_mode %}
< li >
< time class = "dt-published" datetime = "{{ object.ap_published_at.replace(microsecond=0).isoformat() }}" title = "{{ object.ap_published_at.replace(microsecond=0).isoformat() }}" > {{ object.ap_published_at | timeago }}< / time >
< / li >
{% endif %}
2022-07-22 11:55:24 -05:00
{% if object.ap_type == "Question" %}
2022-07-31 11:40:52 -05:00
{% if object.poll_end_time %}
< li >
{% if object.is_poll_ended %}ended{% else %}ends{% endif %}
< time title = "{{ object.poll_end_time.replace(microsecond=0).isoformat() }}" >
{{ object.poll_end_time | timeago }}
< / time >
< / li >
{% endif %}
2022-07-23 16:06:30 -05:00
< li >
2022-07-31 11:40:52 -05:00
{{ object.poll_voters_count }} voters
2022-07-23 16:06:30 -05:00
< / li >
2022-07-22 11:55:24 -05:00
{% endif %}
2022-07-09 01:15:33 -05:00
{% if is_admin %}
< li >
{{ object.visibility.value }}
< / li >
{% endif %}
{% if object.is_from_outbox %}
{% if object.likes_count %}
< li >
< a href = "{{ object.url }}" > < strong > {{ object.likes_count }}< / strong > like{{ object.likes_count | pluralize }}< / a >
< / li >
{% endif %}
{% if object.announces_count %}
< li >
< a href = "{{ object.url }}" > < strong > {{ object.announces_count }}< / strong > share{{ object.announces_count | pluralize }}< / a >
< / li >
{% endif %}
2022-07-10 14:30:50 -05:00
2022-07-14 09:29:17 -05:00
{% if object.webmentions_count %}
2022-07-10 14:30:50 -05:00
< li >
2022-07-14 09:29:17 -05:00
< a href = "{{ object.url }}" > < strong > {{ object.webmentions_count }}< / strong > webmention{{ object.webmentions_count | pluralize }}< / a >
2022-07-10 14:30:50 -05:00
< / li >
{% endif %}
2022-07-09 01:15:33 -05:00
{% endif %}
{% if (object.is_from_outbox or is_admin) and object.replies_count %}
< li >
2022-08-27 02:45:14 -05:00
< a href = "{% if is_admin and not object.is_from_outbox %}{{ url_for(" admin_object " ) } } ? ap_id = {{ object . ap_id } } { % if object . in_reply_to % } # { { object . permalink_id } } { % endif % } { % else % } { { object . url } } { % endif % } " > < strong > {{ object.replies_count }}< / strong > repl{{ object.replies_count | pluralize("y", "ies") }}< / a >
2022-07-09 01:15:33 -05:00
< / li >
{% endif %}
< / ul >
< / nav >
2022-08-15 05:49:07 -05:00
{% if is_admin %}
2022-07-09 01:15:33 -05:00
< nav class = "flexbox activity-bar" >
< ul >
{% if object.is_from_outbox %}
< li >
2022-08-30 12:09:51 -05:00
{{ admin_delete_button(object) }}
2022-07-09 01:15:33 -05:00
< / li >
< li >
{% if object.is_pinned %}
2022-07-15 13:01:55 -05:00
{{ admin_unpin_button(object.ap_id, object.permalink_id) }}
2022-07-09 01:15:33 -05:00
{% else %}
2022-07-15 13:01:55 -05:00
{{ admin_pin_button(object.ap_id, object.permalink) }}
2022-07-09 01:15:33 -05:00
{% endif %}
< / li >
{% endif %}
< li >
{{ admin_reply_button(object.ap_id) }}
< / li >
2022-08-15 05:49:07 -05:00
{% if not object.is_from_outbox %}
2022-07-30 01:31:27 -05:00
< li >
{% if object.liked_via_outbox_object_ap_id %}
{{ admin_undo_button(object.liked_via_outbox_object_ap_id, "unlike", object.permalink_id) }}
{% else %}
{{ admin_like_button(object.ap_id, object.permalink_id) }}
{% endif %}
< / li >
2022-07-09 01:15:33 -05:00
2022-07-30 01:31:27 -05:00
< li >
{% if object.is_bookmarked %}
{{ admin_unbookmark_button(object.ap_id, object.permalink_id) }}
{% else %}
{{ admin_bookmark_button(object.ap_id, object.permalink_id) }}
{% endif %}
< / li >
2022-07-09 01:15:33 -05:00
2022-08-12 03:01:35 -05:00
{% if object.visibility in [visibility_enum.PUBLIC, visibility_enum.UNLISTED] %}
2022-07-30 01:31:27 -05:00
< li >
{% if object.announced_via_outbox_object_ap_id %}
2022-09-29 01:41:24 -05:00
{{ admin_undo_button(object.announced_via_outbox_object_ap_id, "unshare") }}
2022-07-30 01:31:27 -05:00
{% else %}
2022-08-12 03:01:35 -05:00
{{ admin_announce_button(object.ap_id, permalink_id=object.permalink_id) }}
2022-07-30 01:31:27 -05:00
{% endif %}
< / li >
2022-08-12 03:01:35 -05:00
{% endif %}
2022-07-09 01:15:33 -05:00
2022-08-15 05:49:07 -05:00
{% if object.is_from_inbox %}
< li >
{{ admin_profile_button(object.actor.ap_id) }}
< / li >
{% endif %}
{% endif %}
{% if object.is_from_inbox or object.is_from_outbox %}
2022-07-30 01:31:27 -05:00
< li >
2022-08-27 02:45:14 -05:00
{{ admin_expand_button(object) }}
2022-07-30 01:31:27 -05:00
< / li >
{% endif %}
2022-11-13 11:32:38 -06:00
{% if object.is_from_inbox and not object.announced_via_outbox_object_ap_id %}
2022-11-13 11:19:52 -06:00
< li >
{{ admin_force_delete_button(object.ap_id) }}
< / li >
{% endif %}
2022-07-09 01:15:33 -05:00
< / ul >
< / nav >
{% endif %}
2022-07-10 14:30:50 -05:00
{% if likes or shares or webmentions %}
2022-08-29 14:42:54 -05:00
< div class = "public-interactions" >
2022-07-09 01:15:33 -05:00
{% if likes %}
2022-08-29 14:42:54 -05:00
< div class = "interactions-block" > Likes
< div class = "facepile-wrapper" >
2022-07-09 01:15:33 -05:00
{% for like in likes %}
2022-11-17 14:03:24 -06:00
< a href = "{% if is_admin and like.ap_actor_id %}{{ url_for(" admin_profile " ) } } ? actor_id = {{ like . ap_actor_id } } { % else % } { { like . url } } { % endif % } " title = "{{ like.name }}" rel = "noreferrer" >
< img src = "{{ like.picture_url }}" alt = "{{ like.name }}" >
2022-07-09 01:15:33 -05:00
< / a >
{% endfor %}
2022-08-18 13:53:51 -05:00
{% if object.likes_count > likes | length %}
2022-08-29 14:42:54 -05:00
< div class = "and-x-more" >
2022-08-18 13:53:51 -05:00
and {{ object.likes_count - likes | length }} more.
< / div >
{% endif %}
2022-07-09 01:15:33 -05:00
< / div >
< / div >
{% endif %}
{% if shares %}
2022-08-29 14:42:54 -05:00
< div class = "interactions-block" > Shares
< div class = "facepile-wrapper" >
2022-07-09 01:15:33 -05:00
{% for share in shares %}
2022-11-17 14:12:16 -06:00
< a href = "{% if is_admin and share.ap_actor_id %}{{ url_for(" admin_profile " ) } } ? actor_id = {{ share . ap_actor_id } } { % else % } { { share . url } } { % endif % } " title = "{{ share.name }}" rel = "noreferrer" >
2022-11-17 14:03:24 -06:00
< img src = "{{ share.picture_url }}" alt = "{{ share.name }}" >
2022-07-09 01:15:33 -05:00
< / a >
{% endfor %}
2022-08-18 13:53:51 -05:00
{% if object.announces_count > shares | length %}
2022-08-29 14:42:54 -05:00
< div class = "and-x-more" >
2022-08-18 13:53:51 -05:00
and {{ object.announces_count - shares | length }} more.
< / div >
{% endif %}
2022-07-09 01:15:33 -05:00
< / div >
< / div >
{% endif %}
2022-07-10 14:30:50 -05:00
{% if webmentions %}
2022-08-29 14:42:54 -05:00
< div class = "interactions-block" > Webmentions
< div class = "facepile-wrapper" >
2022-07-10 14:30:50 -05:00
{% for webmention in webmentions %}
2022-07-14 09:29:17 -05:00
{% set wm = webmention.as_facepile_item %}
{% if wm %}
2022-08-29 14:42:54 -05:00
< a href = "{{ wm.url }}" title = "{{ wm.actor_name }}" rel = "noreferrer" >
< img src = "{{ wm.actor_icon_url | media_proxy_url }}" alt = "{{ wm.actor_name }}" >
2022-07-14 09:29:17 -05:00
< / a >
{% endif %}
2022-07-10 14:30:50 -05:00
{% endfor %}
< / div >
< / div >
{% endif %}
2022-06-29 15:20:15 -05:00
< / div >
2022-07-07 14:18:20 -05:00
{% endif %}
2022-06-29 15:20:15 -05:00
2022-07-09 01:15:33 -05:00
< / div >
{% endif %}
2022-11-05 05:04:21 -05:00
{% endblock %}
2022-06-25 03:20:07 -05:00
{% endmacro %}