{# Timeline item card partial - reusable across timeline and profile views #} {# Skip empty cards (e.g. Lemmy/PieFed activity IDs with no actual content) #} {% set hasCardContent = item.content and (item.content.html or item.content.text) %} {% set hasCardTitle = item.name %} {% set hasCardMedia = (item.photo and item.photo.length > 0) or (item.video and item.video.length > 0) or (item.audio and item.audio.length > 0) %} {% if hasCardContent or hasCardTitle or hasCardMedia %}
{# Moderation content warning wrapper #} {% if item._moderated %} {% if item._moderationReason == "muted_account" %} {% set modLabel = __("activitypub.moderation.cwMutedAccount") %} {% elif item._moderationReason == "muted_keyword" and item._moderationKeyword %} {% set modLabel = __("activitypub.moderation.cwMutedKeyword") + ' "' + item._moderationKeyword + '"' %} {% else %} {% set modLabel = __("activitypub.moderation.cwFiltered") %} {% endif %}
{% endif %} {# Boost header if this is a boosted post #} {% if item.type == "boost" and item.boostedBy %}
{{ __("activitypub.reader.boosted") }} {% if item.boostedBy.url %}{% if item.boostedBy.nameHtml %}{{ item.boostedBy.nameHtml | safe }}{% else %}{{ item.boostedBy.name or "Someone" }}{% endif %}{% else %}{% if item.boostedBy.nameHtml %}{{ item.boostedBy.nameHtml | safe }}{% else %}{{ item.boostedBy.name or "Someone" }}{% endif %}{% endif %} {{ __("activitypub.reader.boosted") }}
{% endif %} {# Reply context if this is a reply #} {% if item.inReplyTo %}
{{ __("activitypub.reader.replyingTo") }} {{ item.inReplyTo }}
{% endif %} {# Author header #}
{% if item.author.photo %} {{ item.author.name }} {% endif %}
{% if item.author.url %} {% if item.author.nameHtml %}{{ item.author.nameHtml | safe }}{% else %}{{ item.author.name or "Unknown" }}{% endif %} {% else %} {% if item.author.nameHtml %}{{ item.author.nameHtml | safe }}{% else %}{{ item.author.name or "Unknown" }}{% endif %} {% endif %} {% if item.author.bot %}BOT{% endif %}
{% if item.author.handle %}
{{ item.author.handle }}
{% endif %}
{% if item.published %} {% if item.updated %}{% endif %} {% if item.visibility and item.visibility != "public" %} {% endif %} {% endif %}
{# Post title (articles only) #} {% if item.name %}

{{ item.name }}

{% endif %} {# Determine if content should be hidden behind CW #} {% set hasCW = item.summary or item.sensitive %} {% set cwLabel = item.summary if item.summary else __("activitypub.reader.sensitiveContent") %} {% if hasCW %}
{% include "partials/ap-item-content.njk" %}
{% else %} {% include "partials/ap-item-content.njk" %} {% endif %} {# Mentions and hashtags #} {% set hasMentions = item.mentions and item.mentions.length > 0 %} {% set hasHashtags = item.category and item.category.length > 0 %} {% if hasMentions or hasHashtags %}
{# Mentions — render with @ prefix, link to profile view when URL available #} {% if hasMentions %} {% for mention in item.mentions %} {% if mention.url %} @{{ mention.name }} {% else %} @{{ mention.name }} {% endif %} {% endfor %} {% endif %} {# Hashtags — render with # prefix, link to tag timeline #} {% if hasHashtags %} {% for tag in item.category %} #{{ tag }} {% endfor %} {% endif %}
{% endif %} {# Interaction buttons — Alpine.js for optimistic updates #} {# Use canonical AP uid for interactions (Fedify lookupObject), display url for links #} {% set itemUrl = item.url or item.originalUrl %} {% set itemUid = item.uid or item.url or item.originalUrl %} {% set isLiked = interactionMap[itemUid].like if interactionMap[itemUid] else false %} {% set isBoosted = interactionMap[itemUid].boost if interactionMap[itemUid] else false %} {% set replyCount = item.counts.replies if item.counts and item.counts.replies != null else null %} {% set boostCount = item.counts.boosts if item.counts and item.counts.boosts != null else null %} {% set likeCount = item.counts.likes if item.counts and item.counts.likes != null else null %} {# Close moderation content warning wrapper #} {% if item._moderated %}
{# /x-show="shown" #}
{# /ap-card__moderation-cw #} {% endif %}
{% endif %}{# end hasCardContent/hasCardTitle/hasCardMedia guard #}