Files
indiekit-endpoint-activitypub/views/partials/ap-notification-card.njk
svemagie b99f5fb73e Merge upstream rmdes:main — v2.13.0–v2.15.4 into svemagie/main
New upstream features:
- v2.13.0: FEP-8fcf/fe34 compliance, custom emoji, manual follow approval
- v2.14.0: Server blocking, Redis caching, key refresh, async inbox queue
- v2.15.0: Outbox failure handling (strike system), reply chain forwarding
- v2.15.1: Reply intelligence in reader (visibility badges, thread reconstruction)
- v2.15.2: Strip invalid as:Endpoints type from actor serialization
- v2.15.3: Exclude soft-deleted posts from outbox/content negotiation
- v2.15.4: Wire content-warning property for CW text

Conflict resolution:
- federation-setup.js: merged our draft/unlisted/visibility filters with
  upstream's soft-delete filter
- compose.js: kept our DM compose path, adopted upstream's
  lookupWithSecurity for remote object resolution
- notifications.js: kept our separate reply/mention tabs, added upstream's
  follow_request grouping
- inbox-listeners.js: took upstream's thin-shim rewrite (handlers moved to
  inbox-handlers.js which already has DM detection)
- notification-card.njk: merged DM badge with follow_request support

Preserved from our fork:
- Like/Announce to:Public cc:followers addressing
- Nested tag normalization (cat.split("/").at(-1))
- DM compose/reply path in compose controller

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 00:42:31 +01:00

85 lines
3.9 KiB
Plaintext

{# Notification card partial #}
<div class="ap-notification{% if not item.read %} ap-notification--unread{% endif %}{% if item.isDirect %} ap-notification--direct{% endif %}">
{# Dismiss button #}
<form method="post" action="{{ mountPath }}/admin/reader/notifications/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.notifications.dismiss') }}">&times;</button>
</form>
{# Actor avatar with type badge #}
<div class="ap-notification__avatar-wrap" data-avatar-fallback>
{% 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>
<span class="ap-notification__type-badge">
{% if item.type == "like" %}❤{% elif item.type == "boost" %}🔁{% elif item.type == "follow" or item.type == "follow_request" %}👤{% elif item.type == "reply" %}💬{% elif item.type == "mention" %}{% if item.isDirect %}🔒{% else %}@{% endif %}{% elif item.type == "dm" %}✉{% elif item.type == "report" %}⚑{% endif %}
</span>
</div>
{# Notification body #}
<div class="ap-notification__body">
<span class="ap-notification__actor">
<a href="{{ item.actorUrl }}">{{ item.actorName }}</a>
</span>
<span class="ap-notification__action">
{% if item.type == "like" %}
{{ __("activitypub.notifications.liked") }}
{% elif item.type == "boost" %}
{{ __("activitypub.notifications.boostedPost") }}
{% elif item.type == "follow" %}
{{ __("activitypub.notifications.followedYou") }}
{% elif item.type == "follow_request" %}
{{ __("activitypub.followRequest") }}
{% elif item.type == "reply" %}
{{ __("activitypub.notifications.repliedTo") }}
{% elif item.type == "mention" %}
{{ __("activitypub.notifications.mentionedYou") }}
{% elif item.type == "dm" %}
{{ __("activitypub.messages.sentYouDM") }}
{% elif item.type == "report" %}
{{ __("activitypub.reports.sentReport") }}
{% endif %}
</span>
{% if item.targetUrl %}
<a href="{{ item.targetUrl }}" class="ap-notification__target">
{{ item.targetName or item.targetUrl }}
</a>
{% endif %}
{% if item.content and item.content.text %}
<div class="ap-notification__excerpt">
{{ item.content.text | truncate(200) }}
</div>
{% endif %}
{% if item.type == "reply" or item.type == "mention" %}
<div class="ap-notification__actions">
<a href="{{ mountPath }}/admin/reader/compose?replyTo={{ (item.url or item.uid) | urlencode }}" class="ap-notification__reply-btn" title="{{ __('activitypub.reader.actions.reply') }}">
↩ {{ __("activitypub.reader.actions.reply") }}
</a>
<a href="{{ mountPath }}/admin/reader/post?url={{ (item.url or item.uid) | urlencode }}" class="ap-notification__thread-btn" title="{{ __('activitypub.reader.post.title') }}">
💬 {{ __("activitypub.notifications.viewThread") }}
</a>
</div>
{% elif item.type == "dm" %}
<div class="ap-notification__actions">
<a href="{{ mountPath }}/admin/reader/messages?partner={{ item.actorUrl | urlencode }}" class="ap-notification__thread-btn" title="{{ __('activitypub.messages.title') }}">
✉ {{ __("activitypub.messages.viewMessage") }}
</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>