fix: activate mastodon thread for all AP posts, add x-show for empty-state
Build & Deploy / build-and-deploy (push) Successful in 2m6s

This commit is contained in:
svemagie
2026-04-20 18:01:02 +02:00
parent bdcec5752c
commit 6e9147af5e
+5 -9
View File
@@ -22,7 +22,8 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if mentions.length or bskySyndUrl %} {% set mastodonInstance = site.feeds.mastodon.instance %}
{% if mentions.length or bskySyndUrl or mastodonInstance %}
<section class="webmentions mt-8 pt-8 border-t border-surface-200 dark:border-surface-700" id="webmentions"> <section class="webmentions mt-8 pt-8 border-t border-surface-200 dark:border-surface-700" id="webmentions">
<h2 class="text-lg font-semibold text-surface-700 dark:text-surface-300 mb-6"> <h2 class="text-lg font-semibold text-surface-700 dark:text-surface-300 mb-6">
Interactions ({{ mentions.length }}) Interactions ({{ mentions.length }})
@@ -121,14 +122,9 @@
{# Replies — webmention replies merged with Bluesky + Mastodon/AP threads (deduplicated) #} {# Replies — webmention replies merged with Bluesky + Mastodon/AP threads (deduplicated) #}
{% set wm_replies = mentions | webmentionsByType('replies') %} {% set wm_replies = mentions | webmentionsByType('replies') %}
{# Detect Mastodon/AP activity: check if any webmention reply came via fed.brid.gy #} {# Activate Mastodon/AP thread fetching when instance is configured #}
{% set mastodonInstance = site.feeds.mastodon.instance %}
{% set apIdentity = site.fediverseCreator %} {% set apIdentity = site.fediverseCreator %}
{% set hasApReplies = false %} {% set mastodonActive = mastodonInstance %}
{% for reply in wm_replies %}
{% if 'fed.brid.gy' in reply['wm-source'] | default('') %}{% set hasApReplies = true %}{% endif %}
{% endfor %}
{% set mastodonActive = mastodonInstance and hasApReplies %}
{% set replyComponentActive = bskySyndUrl or mastodonActive %} {% set replyComponentActive = bskySyndUrl or mastodonActive %}
{# Filter: remove Bluesky-sourced webmentions if bskySyndUrl; remove fed.brid.gy webmentions if mastodonActive #} {# Filter: remove Bluesky-sourced webmentions if bskySyndUrl; remove fed.brid.gy webmentions if mastodonActive #}
@@ -145,7 +141,7 @@
{% if filtered_replies.length or replyComponentActive %} {% if filtered_replies.length or replyComponentActive %}
{% set wmRepliesCount = filtered_replies.length %} {% set wmRepliesCount = filtered_replies.length %}
<div class="webmention-replies"{% if replyComponentActive %} x-data="socialReplies('{{ bskySyndUrl }}', '{{ absoluteUrl }}', '{{ mastodonInstance if mastodonActive else "" }}', '{{ apIdentity if mastodonActive else "" }}')"{% endif %}> <div class="webmention-replies" x-cloak {% if replyComponentActive %}x-show="{{ wmRepliesCount }} + bskyReplies.length + mastodonReplies.length > 0" x-data="socialReplies('{{ bskySyndUrl }}', '{{ absoluteUrl }}', '{{ mastodonInstance if mastodonActive else "" }}', '{{ apIdentity if mastodonActive else "" }}')"{% endif %}>
<h3 class="text-sm font-semibold text-surface-600 dark:text-surface-400 uppercase tracking-wide mb-4" <h3 class="text-sm font-semibold text-surface-600 dark:text-surface-400 uppercase tracking-wide mb-4"
{% if replyComponentActive %}x-text="({{ wmRepliesCount }} + bskyReplies.length + mastodonReplies.length) + ' Repl' + (({{ wmRepliesCount }} + bskyReplies.length + mastodonReplies.length !== 1) ? 'ies' : 'y')"{% endif %}> {% if replyComponentActive %}x-text="({{ wmRepliesCount }} + bskyReplies.length + mastodonReplies.length) + ' Repl' + (({{ wmRepliesCount }} + bskyReplies.length + mastodonReplies.length !== 1) ? 'ies' : 'y')"{% endif %}>
{% if not replyComponentActive %}{{ wmRepliesCount }} Repl{% if wmRepliesCount != 1 %}ies{% else %}y{% endif %}{% endif %} {% if not replyComponentActive %}{{ wmRepliesCount }} Repl{% if wmRepliesCount != 1 %}ies{% else %}y{% endif %}{% endif %}