feat: add account deletion, announcements and subscription renewal

Support personal records and persistent smoking visibility. Add upload quota preflight, file cleanup, privacy entry, image caching and revision-based page refresh across the backend, admin and mini program.
This commit is contained in:
2026-11-03 22:06:47 +08:00
parent 4c9708b562
commit 8be6d9b1ab
98 changed files with 1679 additions and 372 deletions
+1 -13
View File
@@ -1,7 +1,7 @@
const test=require('node:test');
const assert=require('node:assert/strict');
const path=require('node:path');
const template='tOaqM_Z6pNSih2pVpaUmP86MgwnDT5ZlwOqd0lgmXP8';
const template='K_iQMwE_jre0j6QDVL78DZz7wiR1SKVY5h2YJCK6uPU';
function setup(save){
const storage={coupleId:10},calls=[];
const wx={getStorageSync:key=>storage[key],setStorageSync:(key,v)=>storage[key]=v,requestSubscribeMessage:o=>calls.push(o)};
@@ -24,18 +24,6 @@ test('failed persistence never reports successful subscription and a later tap c
fail=false;pending=e.helper.requestSubscribe('notify');assert.equal(e.calls.length,2);e.calls[1].success({[template]:'accept'});
assert.equal((await pending).notify,true);
});
test('each subsequent user action can replenish authorization; denial does not prevent later attempts',async()=>{
const e=setup(async()=>({success:true}));
let pending=e.helper.requestSubscribeAfterAction('diary');assert.equal(e.calls.length,1);e.calls[0].success({[template]:'reject'});await pending;
pending=e.helper.requestSubscribeAfterAction('photo');assert.equal(e.calls.length,2);e.calls[1].success({[template]:'accept'});await pending;
pending=e.helper.requestSubscribeAfterAction('checkin');assert.equal(e.calls.length,3);e.calls[2].fail(Error('cancelled'));await pending;
pending=e.helper.requestSubscribeAfterAction('checkin');assert.equal(e.calls.length,4);e.calls[3].success({[template]:'accept'});await pending;
});
test('explicitly disabled notifications and unbound users do not prompt during business actions',async()=>{
const e=setup(async()=>({success:true}));e.storage.subscribed_notify=false;await e.helper.requestSubscribeAfterAction('diary');assert.equal(e.calls.length,0);
delete e.storage.subscribed_notify;delete e.storage.coupleId;await e.helper.requestSubscribeAfterAction('diary');assert.equal(e.calls.length,0);
});
test('manual renewal requests authorization again without disabling existing notifications',async()=>{
let page, calls=0, cancelled=0, complete;
const loader=require('./load-module.cjs')({Page:p=>page=p,wx:{showToast(){}}},{