Changeset 780a7c6 in Klonkt for src/routes/posts.js
- Timestamp:
- 07/24/2026 07:44:15 PM (7 weeks ago)
- Branches:
- main
- Children:
- b5924eb
- Parents:
- c26cc18
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
rc26cc18 r780a7c6 931 931 return renderPage(req, res, 'partials/messages-append', { items, seen: seenAt, hasMore, nextOffset: offset + FEED_PAGE, moreBase }); 932 932 } 933 // FEP-633c: pending guardianship offers TO this account (ward side) show 934 // as a special message with an accept button (Robins besluit: the kid 935 // answers in their own Klonkt; safety is handled out-of-band by the 936 // guardians themselves). 937 const guardianOffers = site 938 ? Guardianship.listOffers(site.slug).filter((o) => o.role === 'ward') 939 : []; 933 // FEP-633c: pending guardianship offers TO this account (I am the ward) 934 // show as a special message with an accept button (Robins besluit: the kid 935 // answers in its own Klonkt; safety is out-of-band by the guardians). 936 const gBase = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 937 const gMe = site ? ActivityPubService.actorId(gBase, site.slug) : null; 938 const guardianOffers = (site 939 ? Guardianship.offersCollection(`${gMe}/queues/offers`, site.slug, gMe).orderedItems 940 : []).filter((o) => o['shaer:ward'] === gMe && o['shaer:needsMyAccept']); 940 941 renderPage(req, res, 'pages/messages', { 941 942 pageTitleKey: 'msg.title', bodyClass: 'on-special', items, seenAt, … … 951 952 const back = `${res.locals.siteUrlBase || ''}/messages`; 952 953 const answer = req.body.answer === 'accept' ? 'Accept' : (req.body.answer === 'reject' ? 'Reject' : null); 953 const guardian = String(req.body.guardian || '').trim(); 954 if (!site || !answer || !guardian) return res.redirect(back + '?error=guardianship'); 955 const row = Guardianship.getRelation(site.slug, 'ward', guardian); 956 if (!row || row.status !== 'offered') return res.redirect(back + '?error=guardianship'); 954 const offer = String(req.body.offer || '').trim(); 955 if (!site || !answer || !offer) return res.redirect(back + '?error=guardianship'); 957 956 try { 958 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 959 const me = ActivityPubService.actorId(base, site.slug); 960 const r = await Guardianship.handleGuardianshipOutbox(site, { 961 type: answer, 962 object: row.offer_id || { type: 'Relationship', subject: me, relationship: 'shaer:Guardian', object: guardian }, 963 }); 957 // Same C2S Accept/Reject the apps use; the handshake module records the 958 // ward's accept and (once the candidate returns the handle) commits. 959 const r = await ActivityPubService.ingestOutboxActivity(site, req.session.user, { type: answer, object: offer }); 964 960 if (r && r.status < 400) return res.redirect(back + '?success=' + (answer === 'Accept' ? 'guardian_accepted' : 'guardian_rejected')); 965 961 } catch { /* fall through */ }
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)