Changeset 65abc85 in Klonkt for src/services/guardianship
- Timestamp:
- 07/28/2026 10:40:50 AM (6 weeks ago)
- Branches:
- main
- Children:
- 2708282
- Parents:
- 2a76184
- Location:
- src/services/guardianship
- Files:
-
- 1 added
- 2 edited
-
gated.js (added)
-
handshake.js (modified) (3 diffs)
-
index.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/services/guardianship/handshake.js
r2a76184 r65abc85 19 19 import * as offers from './offers.js'; 20 20 import * as relations from './relations.js'; 21 import * as gated from './gated.js'; 21 22 22 23 let deps = null; … … 155 156 const actor = idOf(activity.actor); 156 157 158 // §5.6: a guardian proposes a gated setting for THIS ward. The ward's server 159 // tallies and enforces, so the decision lands here, not on the proposer. 157 160 if (type === 'Offer') { 161 const gs = gated.parseGatedSetting(activity.object); 162 if (gs) { 163 if (gs.ward !== me) return false; // not our ward 164 gated.rememberGatedOffer(idOf(activity), site.slug, gs.feature, gs.value); 165 // The proposer's Offer carries its own agreement (§3.1's one-step clause). 166 const r = gated.recordGatedVote(site.slug, gs.feature, actor, gs.value); 167 notify(site.slug, { kind: 'gated_setting', feature: gs.feature, value: gs.value, state: r.state }); 168 return true; 169 } 158 170 const rel = parseRelationship(activity.object); 159 171 if (!rel) return false; … … 175 187 // Accept / Reject of an offer we (also) track. 176 188 const offerId = idOf(activity.object); 189 // §5.6: a fellow guardian answering a gated-setting proposal. The Accept only 190 // references the offer, so the value comes from the proposal we stored. A 191 // Reject is a vote for the opposite, not a shrug: it is still an answer. 192 const gsOffer = gated.recallGatedOffer(offerId); 193 if (gsOffer && gsOffer.slug === site.slug) { 194 const value = type === 'Accept' ? !!gsOffer.value : !gsOffer.value; 195 const r = gated.recordGatedVote(site.slug, gsOffer.feature, actor, value); 196 notify(site.slug, { kind: 'gated_setting', feature: gsOffer.feature, value, state: r.state }); 197 return true; 198 } 177 199 let offer = offers.getOffer(site.slug, offerId); 178 200 if (!offer) return false; -
src/services/guardianship/index.js
r2a76184 r65abc85 26 26 actorProps as guardianshipActorProps, 27 27 } from './relations.js'; 28 29 // §5.6 gated settings (decided by the guardians, enforced by the ward's server) 30 export * as gated from './gated.js';
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)