Changeset 742ba7e in Klonkt for src/assets/js/guardian.js
- Timestamp:
- 07/28/2026 07:58:26 PM (6 weeks ago)
- Branches:
- main
- Children:
- 6c152a5
- Parents:
- 70677e96
- File:
-
- 1 edited
-
src/assets/js/guardian.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/assets/js/guardian.js
r70677e96 r742ba7e 184 184 } 185 185 186 /** 187 * The second step of releasing a ward: what it does, then yes or no. 188 * 189 * The warning is assembled from what the server found, not from a fixed 190 * sentence, because releasing means two different things (FEP-633c): stepping 191 * down while other guardians remain (§3.3), or being the last one, which is 192 * emancipation and explicitly not one guardian's call (§3.4). And as long as 193 * the Undo does not federate, the ward's server keeps listing you either way 194 * — a guardian has to know that before pressing, not after. 195 */ 196 function releaseStep(w, check, host, relBtn) { 197 var uri = w.other_uri; 198 var who = handleOf(uri, w.other_handle); 199 var box = el('div', 'g-warn'); 200 box.appendChild(el('strong', null, (T.release_title || 'Release {who}?').replace('{who}', who))); 201 box.appendChild(el('p', null, T.release_effect || '')); 202 if (check.last === true) box.appendChild(el('p', 'grave', T.release_last || '')); 203 else if (check.last === false) box.appendChild(el('p', null, T.release_step_down || '')); 204 else box.appendChild(el('p', 'grave', T.release_unknown || '')); 205 if (check.federates === false) box.appendChild(el('p', null, T.release_local || '')); 206 207 var row = el('div', 'row'); 208 var yes = el('button', 'danger small', T.release_yes || 'Yes'); 209 yes.addEventListener('click', function () { yes.disabled = true; remove(uri, yes); }); 210 var no = el('button', 'small', T.release_no || 'No'); 211 no.addEventListener('click', function () { 212 host.removeChild(box); 213 relBtn.hidden = false; relBtn.disabled = false; 214 }); 215 // No first: the way out should be the easy one to hit. 216 row.appendChild(no); row.appendChild(yes); 217 box.appendChild(row); 218 return box; 219 } 220 186 221 function wardPanel(w) { 187 222 var uri = w.other_uri; … … 215 250 actRow.appendChild(wave); 216 251 var rel = el('button', 'quiet small', T.release); 217 // Releasing a ward is heavy and hard to undo (coming back needs a fresh 218 // offer the ward accepts), so it asks first and spells out what changes. 252 // Letting a child go is a decision, not a click. It opens a step that first 253 // asks the server what releasing this particular ward actually does, then 254 // says it plainly and asks yes or no. Never window.confirm: that hides a 255 // long explanation behind an OK button people press to make it go away. 219 256 rel.addEventListener('click', function () { 220 var who = handleOf(uri, w.other_handle); 221 var msg = (T.release_confirm || 'Release {who}?').replace('{who}', who); 222 if (window.confirm(msg)) remove(uri, rel); 257 rel.disabled = true; 258 // site matters: with several of your own sites the server would otherwise 259 // check this ward against the wrong one and answer "not my ward". 260 fetch('/guardian/wards/release-check?site=' + encodeURIComponent(S.site) + '&uri=' + encodeURIComponent(uri)) 261 .then(function (r) { return r.json(); }) 262 .then(function (c) { 263 rel.hidden = true; 264 act.appendChild(releaseStep(w, c || {}, act, rel)); 265 }) 266 .catch(function () { rel.disabled = false; }); 223 267 }); 224 268 actRow.appendChild(rel);
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)