feat: render quoted posts as embedded cards in reader

Extract quoteUrl from Fedify Note objects (supports Mastodon, Misskey,
Fedibird quote formats). Fetch quoted post data asynchronously on inbox
receive and on-demand in post detail view. Render as rich embed card
with author avatar, handle, content, and timestamp.

Confab-Link: http://localhost:8080/sessions/e9d666ac-3c90-4298-9e92-9ac9d142bc06
This commit is contained in:
Ricardo
2026-03-02 10:33:11 +01:00
parent abf1b94bd6
commit 120f2ee00e
7 changed files with 259 additions and 1 deletions

View File

@@ -91,6 +91,9 @@
</div>
{% endif %}
{# Quoted post embed #}
{% include "partials/ap-quote-embed.njk" %}
{# Link previews #}
{% include "partials/ap-link-preview.njk" %}
@@ -106,6 +109,9 @@
</div>
{% endif %}
{# Quoted post embed #}
{% include "partials/ap-quote-embed.njk" %}
{# Link previews #}
{% include "partials/ap-link-preview.njk" %}

View File

@@ -0,0 +1,41 @@
{# Quoted post embed — renders when a post quotes another post #}
{% if item.quote %}
<div class="ap-quote-embed">
<a href="{{ mountPath }}/admin/reader/post?url={{ item.quote.uid | urlencode }}" class="ap-quote-embed__link">
<header class="ap-quote-embed__author">
{% if item.quote.author.photo %}
<img src="{{ item.quote.author.photo }}" alt="" class="ap-quote-embed__avatar" loading="lazy" crossorigin="anonymous">
{% else %}
<span class="ap-quote-embed__avatar ap-quote-embed__avatar--default">{{ item.quote.author.name[0] | upper if item.quote.author.name else "?" }}</span>
{% endif %}
<div class="ap-quote-embed__author-info">
<div class="ap-quote-embed__name">{{ item.quote.author.name or "Unknown" }}</div>
{% if item.quote.author.handle %}
<div class="ap-quote-embed__handle">{{ item.quote.author.handle }}</div>
{% endif %}
</div>
{% if item.quote.published %}
<time datetime="{{ item.quote.published }}" class="ap-quote-embed__time">{{ item.quote.published | date("PPp") }}</time>
{% endif %}
</header>
{% if item.quote.name %}
<p class="ap-quote-embed__title">{{ item.quote.name }}</p>
{% endif %}
{% if item.quote.content and item.quote.content.html %}
<div class="ap-quote-embed__content">{{ item.quote.content.html | safe }}</div>
{% endif %}
{% if item.quote.photo and item.quote.photo.length > 0 %}
<div class="ap-quote-embed__media">
<img src="{{ item.quote.photo[0] }}" alt="" loading="lazy" class="ap-quote-embed__photo">
</div>
{% endif %}
</a>
</div>
{% elif item.quoteUrl %}
{# Fallback: quote not yet fetched — show as styled link #}
<div class="ap-quote-embed ap-quote-embed--pending">
<a href="{{ mountPath }}/admin/reader/post?url={{ item.quoteUrl | urlencode }}" class="ap-quote-embed__link">
Quoted post: {{ item.quoteUrl }}
</a>
</div>
{% endif %}