| 1 | <%# Renders one fediverse thread node (n). Expects: n, t, canManageSite, _base, siteAvatar, formatDateTime %>
|
|---|
| 2 | <div class="comment-avatar">
|
|---|
| 3 | <% if (n.mine) { %>
|
|---|
| 4 | <% if (typeof siteAvatar !== 'undefined' && siteAvatar) { %><img src="<%= siteAvatar %>" alt="">
|
|---|
| 5 | <% } else { %><span><%= t('fedi.you').charAt(0).toUpperCase() %></span><% } %>
|
|---|
| 6 | <% } else if (n.actor_icon) { %><img src="<%= n.actor_icon %>" alt="" loading="lazy">
|
|---|
| 7 | <% } else { %><span><%= (n.actor_name || '?').charAt(0).toUpperCase() %></span><% } %>
|
|---|
| 8 | </div>
|
|---|
| 9 | <div class="comment-body">
|
|---|
| 10 | <div class="comment-meta">
|
|---|
| 11 | <% if (n.mine) { %>
|
|---|
| 12 | <span class="comment-author"><%= t('fedi.you') %></span>
|
|---|
| 13 | <% } else { %>
|
|---|
| 14 | <a class="comment-author" href="<%= n.actor_url %>" rel="nofollow noopener" target="_blank"><%= n.actor_name %></a>
|
|---|
| 15 | <span class="fedi-handle"><%= n.actor_handle %></span>
|
|---|
| 16 | <% } %>
|
|---|
| 17 | <% if (n.created_at) { %><span class="comment-time"><%= formatDateTime(n.created_at) %></span><% } %>
|
|---|
| 18 | </div>
|
|---|
| 19 | <div class="comment-content"><%- n.content %></div>
|
|---|
| 20 | <div class="comment-actions">
|
|---|
| 21 | <% if (n.mine && typeof canManageSite !== 'undefined' && canManageSite && n.outboxId) { %>
|
|---|
| 22 | <form method="post" action="<%= _base %>/fediverse/<%= n.outboxId %>/delete" onsubmit="return confirm('<%= t('fedi.delete_confirm') %>')">
|
|---|
| 23 | <button type="submit" class="comment-delete-btn"><%= t('comments.delete') %></button>
|
|---|
| 24 | </form>
|
|---|
| 25 | <% } else if (!n.mine && n.noteId) { %>
|
|---|
| 26 | <button type="button" class="comment-reply-btn fedi-remote-reply-btn" data-fedi-uri="<%= n.noteId %>" data-fedi-prompt="<%= t('fedi.remote_prompt') %>">
|
|---|
| 27 | <svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 17 4 12 9 7"/><path d="M20 18v-2a4 4 0 0 0-4-4H4"/></svg>
|
|---|
| 28 | <%= t('fedi.remote_reply_short') %>
|
|---|
| 29 | </button>
|
|---|
| 30 | <% } %>
|
|---|
| 31 | </div>
|
|---|
| 32 | <% if (n.children && n.children.length) { %>
|
|---|
| 33 | <ol class="comment-replies">
|
|---|
| 34 | <% n.children.forEach(function(c){ %>
|
|---|
| 35 | <li class="comment comment-reply"><%- include('../partials/fedi-node', { n: c }) %></li>
|
|---|
| 36 | <% }); %>
|
|---|
| 37 | </ol>
|
|---|
| 38 | <% } %>
|
|---|
| 39 | </div>
|
|---|