<%- include('../partials/fedi-tabs', { active: 'connect' }) %>
<%= t('tl.connect') %>
<% if (typeof success !== 'undefined' && success) { %>
<%= success %>
<% } %>
<% if (typeof error !== 'undefined' && error) { %>
<%= error %>
<% } %>
<%# FEP-633c §2 + §3.6: who guards this account, and how available each of
them is. Connect is the "who am I connected to" page, and a guardian is
the one connection a ward should never have to hunt for. Availability in
buddy-list language on the responsibility axis; the labels are UI, the
wire keeps the spec terms. Never public: this page is the owner's. %>
<% if (typeof myGuardians !== 'undefined' && myGuardians.length) { %>
🛡 <%= t('msg.guardians_label') %>
<% myGuardians.forEach(function(g){
var _st = g.availability === 'away' ? 'away' : (g.availability === 'dormant' ? 'dormant' : 'active');
var _lbl = _st === 'away' ? t('msg.g_away', { date: g.awayUntil ? formatDate(g.awayUntil) : '?' })
: (_st === 'dormant' ? t('msg.g_offline') : t('msg.g_available')); %>
-
<%= g.handle %>
<%= _lbl %>
<% }); %>
<% } %>
<%
var conns = connections || [];
var reachable = conns.filter(function (c) { return !c.unreachable; });
var unreachable = conns.filter(function (c) { return c.unreachable; });
// Display fields for one connection: name/handle (fallback: derive from actor_uri).
function connView(c) {
var host = '', user = '';
try { var u = new URL(c.actor_uri); host = u.hostname; user = (u.pathname.split('/').filter(Boolean).pop() || ''); } catch (e) {}
var handle = c.handle || (user ? ('@' + user + '@' + host) : c.actor_uri);
var display = c.name || handle;
return { handle: handle, display: display,
initial: String(display || '?').replace(/^@/, '').charAt(0).toUpperCase(),
profileUrl: c.url || c.actor_uri };
}
function arrow(dir) { return dir === 'mutual' ? '↔' : (dir === 'following' ? '→' : '←'); }
%>
<% if (reachable.length) { %>
<% reachable.forEach(function (c) { var v = connView(c); %>
-
<% if (c.icon) { %>
<% } else { %><%= v.initial %><% } %>
<%= v.display %>
<%= arrow(c.direction) %> <%= t('tl.dir_' + c.direction) %>
<% if (c.follower && c.last_delivery_at) { %>· <%= t('tl.last_delivery') %>: <%= formatDateTime(c.last_delivery_at) %><% } %>
<% if (c.following) { %>
<% } %>
<% }); %>
<% } else { %>
<%= t('tl.connect_empty') %>
<% } %>
<% if (unreachable.length) { %>
⚠ <%= t('tl.unreachable') %> (<%= unreachable.length %>)
<%= t('tl.unreachable_lead') %>
<% unreachable.forEach(function (c) { var v = connView(c); %>
-
<% if (c.icon) { %>
<% } else { %><%= v.initial %><% } %>
<%= v.display %>
<%= arrow(c.direction) %> <%= t('tl.dir_' + c.direction) %>
<% if (c.last_delivery_at) { %>· <%= t('tl.last_delivery') %>: <%= formatDateTime(c.last_delivery_at) %><% } else { %>· <%= t('tl.never_delivered') %><% } %>
<% if (c.last_error_at) { %>· <%= t('tl.delivery_failed') %>: <%= formatDateTime(c.last_error_at) %><% } %>
<% if (c.follower_id) { %>
<% } %>
<% }); %>
<% } %>