<%# Renders one fediverse thread node (n). Expects: n, t, canManageSite, _base, siteAvatar, formatDateTime, postSlug %>
<% if (n.actor_icon) { %> <% } else { %><%= (n.actor_name || '?').charAt(0).toUpperCase() %><% } %>
<% if (n.actor_url) { %><%- emojiName(n.actor_name, n.actor_emoji_json) %> <% } else { %><%- emojiName(n.actor_name, n.actor_emoji_json) %><% } %> <% if (n.actor_handle) { %><%= n.actor_handle %><% } %> <% if (n.created_at) { %><%= formatDateTime(n.created_at) %><% } %>
<%- emojiHtml(n.content, n.emoji_json) %>
<%# Rich replies: media on our own sent replies (attachments on the Note). Visitors see these too, and the reply editor (owner-only) may not render, so make sure the stylesheet is on the page either way. %> <% if (n.media && n.media.length) { %> <% if (!locals.__reAssets) { locals.__reAssets = 1; %><% } %>
<% n.media.forEach(function (m) { %> <% if ((m.mediaType || '').indexOf('image/') === 0) { %> <%= m.name || '' %> <% } else if ((m.mediaType || '').indexOf('audio/') === 0) { %> <% } else { %> <% } %> <% }); %>
<% } %>
<% if (n.mine && typeof canManageSite !== 'undefined' && canManageSite && n.outboxId) { %>
<% } else if (!n.mine && typeof canManageSite !== 'undefined' && canManageSite && n.id && typeof postSlug !== 'undefined' && postSlug) { %> <%# Owner: like / boost / reply directly AS the site — no "your server" detour (it's your own site). %>
<% if (locals.mayReply !== false) { %>
<%- include('reply-editor', { action: _base + '/posts/' + postSlug + '/fedi-reply', hiddenFields: [{ name: 'interaction_id', value: n.id }], placeholder: t('fedi.reply_ph'), submitLabel: t('fedi.send'), rows: 2, participants: n.participants || [], }) %>
<% } %> <%# Owner moderation: report to their instance + remove (tombstoned: never comes back via re-delivery or thread-crawl). %>
<% } else if (n.noteId) { %> <%# Visitor: reply via YOUR OWN instance. Also on the site's own (mine) comments — those are dereferenceable Notes (/ap/notes/) too; without this a visitor could not reply to the owner's comments at all (only the owner branches above catch mine-nodes for managers, so this else-if never renders for the owner). %> <% } %>
<% if (n.children && n.children.length) { %>
    <% n.children.forEach(function(c){ %>
  1. <%- include('../partials/fedi-node', { n: c, t: t, canManageSite: (typeof canManageSite !== 'undefined' ? canManageSite : false), _base: _base, siteAvatar: (typeof siteAvatar !== 'undefined' ? siteAvatar : null), formatDateTime: formatDateTime, postSlug: (typeof postSlug !== 'undefined' ? postSlug : null) }) %>
  2. <% }); %>
<% } %>