Files
indiekit-endpoint-activitypub/views/partials/ap-message-card.njk
Ricardo 1dc42ad5e5 feat: outbound Delete, visibility addressing, CW/sensitive, polls, Flag reports (v2.10.0)
- Outbound Delete: broadcastDelete() + POST /admin/federation/delete route
- Visibility: unlisted + followers-only addressing via defaultVisibility config
- Content Warning: outbound sensitive flag + summary as CW text
- Polls: inbound Question/poll parsing with progress bar rendering
- Flag: inbound report handler with ap_reports collection + Reports tab
- Includes DM support files from v2.9.x (messages controller, storage, templates)
- Includes coverage audit and high-impact gaps implementation plan

Confab-Link: http://localhost:8080/sessions/cc343b15-8d10-43cd-a48f-ca912eb79b83
2026-03-14 08:51:44 +01:00

66 lines
3.0 KiB
Plaintext

{# Message card partial — inbound/outbound DM display #}
<div class="ap-notification ap-message{% if not item.read %} ap-notification--unread{% endif %}{% if item.direction == 'outbound' %} ap-message--outbound{% endif %}">
{# Dismiss button #}
<form method="post" action="{{ mountPath }}/admin/reader/messages/delete" class="ap-notification__dismiss">
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
<input type="hidden" name="uid" value="{{ item.uid }}">
<button type="submit" class="ap-notification__dismiss-btn" title="{{ __('activitypub.messages.delete') }}">&times;</button>
</form>
{# Avatar — outbound: our profile photo, inbound: sender's photo #}
<div class="ap-notification__avatar-wrap" data-avatar-fallback>
{% if item.direction == "outbound" and myProfile and myProfile.icon %}
<img src="{{ myProfile.icon }}" alt="{{ myProfile.name or 'Me' }}" class="ap-notification__avatar" loading="lazy" crossorigin="anonymous">
<span class="ap-notification__avatar ap-notification__avatar--default" aria-hidden="true">{{ (myProfile.name or "M")[0] | upper }}</span>
{% else %}
{% if item.actorPhoto %}
<img src="{{ item.actorPhoto }}" alt="{{ item.actorName }}" class="ap-notification__avatar" loading="lazy" crossorigin="anonymous">
{% endif %}
<span class="ap-notification__avatar ap-notification__avatar--default" aria-hidden="true">{{ item.actorName[0] | upper if item.actorName else "?" }}</span>
{% endif %}
<span class="ap-notification__type-badge">
{% if item.direction == "outbound" %}↗{% else %}✉{% endif %}
</span>
</div>
{# Message body #}
<div class="ap-notification__body">
<span class="ap-notification__actor">
{% if item.direction == "outbound" %}
<span class="ap-message__direction">{{ __("activitypub.messages.sentTo") }}</span>
{% endif %}
<a href="{{ item.actorUrl }}">{{ item.actorName }}</a>
{% if item.actorHandle %}
<span class="ap-notification__handle">{{ item.actorHandle }}</span>
{% endif %}
</span>
{% if item.content and item.content.html %}
<div class="ap-message__content">
{{ item.content.html | safe }}
</div>
{% elif item.content and item.content.text %}
<div class="ap-message__content">
{{ item.content.text }}
</div>
{% endif %}
{# Reply action (only for inbound messages) #}
{% if item.direction == "inbound" %}
<div class="ap-notification__actions">
<a href="{{ mountPath }}/admin/reader/messages/compose?to={{ item.actorHandle | urlencode }}&replyTo={{ item.uid | urlencode }}" class="ap-notification__reply-btn">
↩ {{ __("activitypub.reader.actions.reply") }}
</a>
</div>
{% endif %}
</div>
{# Timestamp #}
{% if item.published %}
<time datetime="{{ item.published }}" class="ap-notification__time" x-data x-relative-time>
{{ item.published | date("PPp") }}
</time>
{% endif %}
</div>