Changeset 439f095 in Klonkt for src/routes


Ignore:
Timestamp:
07/28/2026 11:48:34 PM (6 weeks ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
88d7c8f
Parents:
0202104
Message:

De guardians-lijst verhuist van Berichten naar Connect

Connect is de pagina die vertelt met wie je verbonden bent, en een guardian is
precies de verbinding die een kind nooit zou moeten hoeven zoeken. In Berichten
stond hij boven een stroom meldingen, waar hij bij elk bezoek langsschuift; op
Connect staat hij bij de andere relaties, met een eigen kader omdat het geen
mensen zijn die je zelf gekozen hebt te volgen.

De stippen en de labels gaan mee zoals ze waren: beschikbaar, afwezig tot een
datum, offline. In Berichten blijft het guardianship-aanbod staan, want dat is
wel een bericht: er wordt iets aan je gevraagd.

Changed files:
src/routes/posts.js

  • myGuardians van /messages naar /connect, met de handle-helper mee; de helper in /messages was daarmee dood en is weg

src/views/pages/messages.ejs

  • het blok en zijn opmaak eruit

src/views/pages/connect.ejs

  • de guardians-sectie bovenaan, met eigen opmaak

remarks: in de browser nagelopen, ook op 375px: drie guardians in drie staten
op Connect, Berichten houdt alleen nog het aanbod. 276 tests groen.

-robo
Co-Authored-By: Claude Opus 5 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r0202104 r439f095  
    939939    ? Guardianship.offersCollection(`${gMe}/queues/offers`, site.slug, gMe).orderedItems
    940940    : []).filter((o) => o['shaer:ward'] === gMe && o['shaer:needsMyAccept']);
    941   // FEP-633c §2: who guards this account (committed). Shown so a ward can always
    942   // see its guardians, not just pending offers. Derive a display @handle when the
    943   // 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 real
    950   // 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     }));
    963941  renderPage(req, res, 'pages/messages', {
    964942    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,
    966944    success: req.query.success || null, error: req.query.error || null,
    967945  });
     
    11621140  const site = res.locals.site;
    11631141  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    }));
    11641162  renderPage(req, res, 'pages/connect', {
    11651163    pageTitle: 'Connect', bodyClass: 'on-special',
    1166     connections,
     1164    connections, myGuardians,
    11671165    success: req.query.success || null, error: req.query.error || null,
    11681166  });
Note: See TracChangeset for help on using the changeset viewer.