Changeset 439f095 in Klonkt for src/routes/posts.js
- Timestamp:
- 07/28/2026 11:48:34 PM (6 weeks ago)
- Branches:
- main
- Children:
- 88d7c8f
- Parents:
- 0202104
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r0202104 r439f095 939 939 ? Guardianship.offersCollection(`${gMe}/queues/offers`, site.slug, gMe).orderedItems 940 940 : []).filter((o) => o['shaer:ward'] === gMe && o['shaer:needsMyAccept']); 941 // FEP-633c §2: who guards this account (committed). Shown so a ward can always942 // see its guardians, not just pending offers. Derive a display @handle when the943 // stored one is missing or is the escalation (inbox) handle rather than a @handle.944 const guardianHandle = (uri, cached) => {945 if (cached && cached.charAt(0) === '@') return cached;946 try { const u = new URL(uri); return `@${u.pathname.split('/').filter(Boolean).pop()}@${u.host}`; }947 catch { return uri; }948 };949 // With their availability (FEP-633c 3.6.1): the ward always sees the real950 // size of its safety net, not just the names. Owner-only by construction:951 // this page is the owner's.952 const gStatus = site ? Object.fromEntries(953 Guardianship.availability.statusesFor(site.slug, Guardianship.listGuardians(site.slug).map((g) => g.other_uri), Date.now())954 .map((s) => [s.id, s]),955 ) : {};956 const myGuardians = (site ? Guardianship.listGuardians(site.slug) : [])957 .map((g) => ({958 uri: g.other_uri,959 handle: guardianHandle(g.other_uri, g.other_handle),960 availability: (gStatus[g.other_uri] || {})['shaer:availability'] || 'active',961 awayUntil: (gStatus[g.other_uri] || {})['shaer:awayUntil'] || null,962 }));963 941 renderPage(req, res, 'pages/messages', { 964 942 pageTitleKey: 'msg.title', bodyClass: 'on-special', items, seenAt, 965 hasMore, nextOffset: offset + FEED_PAGE, moreBase, guardianOffers, myGuardians,943 hasMore, nextOffset: offset + FEED_PAGE, moreBase, guardianOffers, 966 944 success: req.query.success || null, error: req.query.error || null, 967 945 }); … … 1162 1140 const site = res.locals.site; 1163 1141 const connections = site ? ActivityPubService.listConnections(site.slug) : []; 1142 // FEP-633c §2: the ward always sees who guards it, and §3.6 how available 1143 // each of them is. Connect is where "who am I connected to" belongs; a 1144 // guardian is the one connection a ward should never have to hunt for. 1145 // Owner-only by construction: this page is the owner's. 1146 const guardianHandle = (uri, cached) => { 1147 if (cached && cached.charAt(0) === '@') return cached; 1148 try { const u = new URL(uri); return `@${u.pathname.split('/').filter(Boolean).pop()}@${u.host}`; } 1149 catch { return uri; } 1150 }; 1151 const gStatus = site ? Object.fromEntries( 1152 Guardianship.availability.statusesFor(site.slug, Guardianship.listGuardians(site.slug).map((g) => g.other_uri), Date.now()) 1153 .map((s) => [s.id, s]), 1154 ) : {}; 1155 const myGuardians = (site ? Guardianship.listGuardians(site.slug) : []) 1156 .map((g) => ({ 1157 uri: g.other_uri, 1158 handle: guardianHandle(g.other_uri, g.other_handle), 1159 availability: (gStatus[g.other_uri] || {})['shaer:availability'] || 'active', 1160 awayUntil: (gStatus[g.other_uri] || {})['shaer:awayUntil'] || null, 1161 })); 1164 1162 renderPage(req, res, 'pages/connect', { 1165 1163 pageTitle: 'Connect', bodyClass: 'on-special', 1166 connections, 1164 connections, myGuardians, 1167 1165 success: req.query.success || null, error: req.query.error || null, 1168 1166 });
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)