Time requests from the lock screen: one request with +15/+30/+1 h buttons, lock lifts quickly
build-container / build (push) Successful in 4m9s

- Ask a parent on the lock screen also makes a request parents answer in Settings > Family
- Parents choose how many minutes; the child's lock screen rechecks every few seconds
- Notification links open Settings > Family
- Test updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-26 17:03:43 -04:00
1 parent 301e8017d9
commit b1c720c74f
7 files changed
+22 -10

No files matched your search

+3
View File
@@ -23,6 +23,9 @@ const call = (who, url, method = 'GET', body, mod = requests) => new Promise(ok
assert.equal((await call(kai, '/api/kid/requests/' + r.id, 'POST', { approve: true })).status, 403, 'a child cannot approve their own'); const before = kid.status(users.get(kai.id)).limit; assert.equal((await call(ann, '/api/kid/requests/' + r.id, 'POST', { approve: true, note: 'Weekend only' })).json.status, 'approved');
assert.ok(users.can(users.get(kai.id), 'video'), 'a yes opens the part of the hub'); assert.equal(kid.status(users.get(kai.id)).limit, before + 20, 'and adds the minutes'); assert.ok(inbox.load(kai.id).some(i => /^Yes: /.test(i.title)), 'the child is told');
r = (await call(kai, '/api/kid/requests', 'POST', { text: 'A new game' })).json; assert.equal((await call(ann, '/api/kid/requests/' + r.id, 'POST', { approve: false, note: 'Not now' })).json.status, 'denied'); assert.equal((await call(ann, '/api/kid/requests/' + r.id, 'POST', { approve: true })).status, 400, 'answered once');
// asking for time from the lock screen makes one request the parent can answer with minutes
const t1 = requests.askTime(users.get(kai.id), 'Can I have more time?', 30), t2 = requests.askTime(users.get(kai.id), 'again', 30); assert.equal(t1.id, t2.id, 'asking twice is one request'); const lim1 = kid.status(users.get(kai.id)).limit;
assert.equal((await call(ann, '/api/kid/requests/' + t1.id, 'POST', { approve: true, minutes: 15 })).json.minutes, 15, 'the parent chooses how much'); assert.equal(kid.status(users.get(kai.id)).limit, lim1 + 15);
// a reward with bonus screen time adds it when the parent marks it given
users.update(kai.id, { tabs: [...users.get(kai.id).tabs, 'chores'] }); await call(ann, '/api/chores', 'POST', { title: 'Dishes', repeat: 'daily', assign: 'anyone', points: 10 }, chores); const today = new Date().toISOString().slice(0, 10), ch = (await call(ann, '/api/chores?date=' + today, 'GET', null, chores)).json.chores[0];
await call(kai, '/api/chores/done', 'POST', { chore: ch.id, date: today }, chores); const rw = (await call(ann, '/api/chores/reward', 'POST', { title: 'Extra time', points: 5, minutes: 30 }, chores)).json; assert.equal(rw.minutes, 30);