feat: send bounded push digests for update bursts (Closes #569)
CI / lint (pull_request) Successful in 1m19s
CI / build-release (pull_request) Successful in 5s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-11 12:57:07 +00:00
1 parent c94fc5308f
commit 5e0683cd4a
7 files changed
+245 -5

No files matched your search

+15
View File
@@ -278,6 +278,21 @@ self.addEventListener('push', event => {
const route = String(payload.route || '');
const tag = String(payload.tag || '');
const notificationId = Number(payload.notification_id);
const updateCount = Number(payload.update_count);
if (
route === '#/my-work/updates'
&& tag === 'stackchain-update-digest'
&& Number.isSafeInteger(updateCount)
&& updateCount > 0
&& updateCount <= 50
) {
event.waitUntil(self.registration.showNotification(updateCount + ' new work updates', {
body: 'Tap to review them in Stackchain.',
tag,
data: {route},
}));
return;
}
if (!/^#\/my-work\/update\/\d+$/.test(route) || !/^stackchain-update-\d+$/.test(tag)) return;
const options = {
body: 'Tap to review it in Stackchain.',