source: Klonkt/src/views/partials/fedi-node.ejs@ e91849c

main
Last change on this file since e91849c was e91849c, checked in by Robin Genis <roboburr@…>, 3 months ago

ux(fedi): owner replies to a fediverse comment directly (no 'your server' detour)

On your own site, the reply button under an inbound fediverse comment showed
the visitor flow (asks for 'your server' and bounces to authorize_interaction).
For the site owner that is pointless — you ARE the server. Owners now get an
inline reply box that posts straight to /posts/:slug/fedi-reply (deliverReply as
the site); visitors keep the remote-interaction popover. Exposes the interaction
id on inbound nodes + threads postSlug through fedi-node.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[e91849c]1<%# Renders one fediverse thread node (n). Expects: n, t, canManageSite, _base, siteAvatar, formatDateTime, postSlug %>
[7d932ce]2<div class="comment-avatar">
[c73ac64]3 <% if (n.actor_icon) { %><img src="<%= n.actor_icon %>" alt="" loading="lazy">
[7d932ce]4 <% } else { %><span><%= (n.actor_name || '?').charAt(0).toUpperCase() %></span><% } %>
5</div>
6<div class="comment-body">
7 <div class="comment-meta">
[c73ac64]8 <% if (n.actor_url) { %><a class="comment-author" href="<%= n.actor_url %>" rel="nofollow noopener" target="_blank"><%= n.actor_name %></a>
9 <% } else { %><span class="comment-author"><%= n.actor_name %></span><% } %>
10 <% if (n.actor_handle) { %><span class="fedi-handle"><%= n.actor_handle %></span><% } %>
[7d932ce]11 <% if (n.created_at) { %><span class="comment-time"><%= formatDateTime(n.created_at) %></span><% } %>
12 </div>
13 <div class="comment-content"><%- n.content %></div>
14 <div class="comment-actions">
15 <% if (n.mine && typeof canManageSite !== 'undefined' && canManageSite && n.outboxId) { %>
16 <form method="post" action="<%= _base %>/fediverse/<%= n.outboxId %>/delete" onsubmit="return confirm('<%= t('fedi.delete_confirm') %>')">
17 <button type="submit" class="comment-delete-btn"><%= t('comments.delete') %></button>
18 </form>
[e91849c]19 <% } else if (!n.mine && typeof canManageSite !== 'undefined' && canManageSite && n.id && typeof postSlug !== 'undefined' && postSlug) { %>
20 <%# Owner: reply directly AS the site — no "your server" detour (it's your own site). %>
21 <details class="fedi-owner-reply">
22 <summary class="comment-reply-btn">
23 <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>
24 <%= t('fedi.remote_reply_short') %>
25 </summary>
26 <form method="post" action="<%= _base %>/posts/<%= postSlug %>/fedi-reply" class="comment-reply-form">
27 <input type="hidden" name="interaction_id" value="<%= n.id %>">
28 <textarea name="text" rows="2" required placeholder="<%= t('fedi.reply_ph') %>"></textarea>
29 <div class="comment-reply-form-actions">
30 <button type="submit" class="btn"><%= t('fedi.send') %></button>
31 </div>
32 </form>
33 </details>
[7d932ce]34 <% } else if (!n.mine && n.noteId) { %>
[c901131]35 <button type="button" class="comment-reply-btn fedi-remote-reply-btn" data-fedi-uri="<%= n.noteId %>" data-fedi-ph="<%= t('fedi.remote_ph') %>">
[7d932ce]36 <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>
37 <%= t('fedi.remote_reply_short') %>
38 </button>
39 <% } %>
40 </div>
41 <% if (n.children && n.children.length) { %>
42 <ol class="comment-replies">
43 <% n.children.forEach(function(c){ %>
[e91849c]44 <li class="comment comment-reply"><%- 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) }) %></li>
[7d932ce]45 <% }); %>
46 </ol>
47 <% } %>
48</div>
Note: See TracBrowser for help on using the repository browser.