Changeset e5fc801 in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 08/07/2026 09:23:16 AM (5 weeks ago)
- Branches:
- main
- Children:
- 44c9f3f
- Parents:
- f2a7181
- git-author:
- Robin <roboburr@…> (08/07/2026 09:23:07 AM)
- git-committer:
- roboburr <roboburr@…> (08/07/2026 09:23:16 AM)
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rf2a7181 re5fc801 5278 5278 // Guardian PWA / Berichten push. The kid answers an incoming offer in its 5279 5279 // own Berichten; an existing guardian and a commit land in the PWA. 5280 // 5281 // De labels hangen aan dezelfde sleutels als het Guardian-paneel, zodat een 5282 // melding en het scherm waar hij heen wijst hetzelfde woord gebruiken. 5280 5283 onEvent: (slug, ev) => { 5281 const L = pushLang(slug); 5282 const texts = { 5283 offer_received: ['push.n_guard_offer_t', 'push.n_guard_offer_b'], // I am the ward 5284 offer_for_ward: ['push.n_guard_cog_t', 'push.n_guard_cog_b'], // I co-guard this ward 5285 committed: ['push.n_guard_ward_t', 'push.n_guard_ward_b'], 5286 // §3.2: a guardian ended the relation. The ward hears that someone who 5287 // was looking after them has gone; a co-guardian hears they are one fewer. 5288 guardian_left: ['push.n_guard_left_t', 'push.n_guard_left_b'], 5289 coguardian_left: ['push.n_guard_cogleft_t', 'push.n_guard_cogleft_b'], 5290 }[ev.kind]; 5291 if (!texts) return; 5292 const who = deriveHandle(ev.candidate || ev.guardian || ev.ward || '') || '?'; 5293 const url = (ev.kind === 'offer_received' || ev.kind === 'guardian_left') ? `${pushPrefix(slug)}/messages` : '/guardian'; 5294 pushEvent(slug, { type: 'guardian', title: i18nT(L, texts[0]), body: i18nT(L, texts[1], { who }), url }); 5284 const p = guardianEventPush(slug, ev); 5285 if (p) pushEvent(slug, p); 5295 5286 }, 5296 5287 }); 5288 5289 /** 5290 * Welke melding hoort bij een guardianship-gebeurtenis, of geen. 5291 * 5292 * Apart en puur, omdat dit een BESLISSING is en geen bezorging: de 5293 * guardianship-module zendt veertien soorten uit en deze tabel bepaalt welke 5294 * daarvan een mens wakker maken. Dat hoort toetsbaar te zijn zonder web-push 5295 * erbij te halen. 5296 */ 5297 export function guardianEventPush(slug, ev) { 5298 const L = pushLang(slug); 5299 const texts = { 5300 offer_received: ['push.n_guard_offer_t', 'push.n_guard_offer_b'], // I am the ward 5301 offer_for_ward: ['push.n_guard_cog_t', 'push.n_guard_cog_b'], // I co-guard this ward 5302 committed: ['push.n_guard_ward_t', 'push.n_guard_ward_b'], 5303 // §3.2: a guardian ended the relation. The ward hears that someone who 5304 // was looking after them has gone; a co-guardian hears they are one fewer. 5305 guardian_left: ['push.n_guard_left_t', 'push.n_guard_left_b'], 5306 coguardian_left: ['push.n_guard_cogleft_t', 'push.n_guard_cogleft_b'], 5307 // 5.6 gated settings. Zonder deze twee is de hele tally stil: een guardian 5308 // hoort niet dat er een antwoord van hem gewenst is, en dus loopt het 5309 // venster leeg en verloopt het voorstel. Een drempel die niemand ziet is 5310 // geen drempel. 5311 gated_review: ['push.n_gate_ask_t', 'push.n_gate_ask_b'], // jij moet antwoorden 5312 gated_outcome: ['push.n_gate_done_t', 'push.n_gate_done_b'], // er is besloten 5313 }[ev.kind]; 5314 if (!texts) return null; 5315 const who = deriveHandle(ev.candidate || ev.guardian || ev.ward || '') || '?'; 5316 // Een gate-melding zonder te zeggen WELKE instelling is nutteloos: er zijn er 5317 // meer dan een, en ze betekenen heel verschillende dingen voor een kind. 5318 const wat = i18nT(L, GATE_LABEL[ev.feature] || 'guardian.prop_embeds'); 5319 const stand = i18nT(L, ev.value ? 'guardian.prop_on' : 'guardian.prop_off'); 5320 const uitkomst = i18nT(L, GATE_OUTCOME[ev.outcome] || 'guardian.prop_st_open'); 5321 const url = (ev.kind === 'offer_received' || ev.kind === 'guardian_left') ? `${pushPrefix(slug)}/messages` : '/guardian'; 5322 return { type: 'guardian', title: i18nT(L, texts[0]), body: i18nT(L, texts[1], { who, wat, stand, uitkomst }), url }; 5323 } 5324 5325 // Van een gated feature naar het woord dat het Guardian-paneel er al voor 5326 // gebruikt. Een onbekende feature valt terug op het algemene woord in plaats van 5327 // de melding te laten vervallen: liever een iets vager bericht dan geen bericht. 5328 const GATE_LABEL = { 5329 'shaer:externalEmbeds': 'guardian.prop_embeds', 5330 'shaer:externalPlayback': 'guardian.prop_play', 5331 }; 5332 const GATE_OUTCOME = { 5333 accepted: 'guardian.prop_st_accepted', 5334 rejected: 'guardian.prop_st_rejected', 5335 expired: 'guardian.prop_st_expired', 5336 }; 5297 5337 5298 5338 // The notification duty of FEP-633c 3.6.2, wired once for every place a
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)