update notification text using sid in web app

This commit is contained in:
Hunter Kehoe
2025-10-17 22:10:11 -06:00
parent 83b5470bc5
commit 8293a24cf9
6 changed files with 90 additions and 11 deletions

View File

@@ -70,6 +70,8 @@
"notifications_delete": "Delete",
"notifications_copied_to_clipboard": "Copied to clipboard",
"notifications_tags": "Tags",
"notifications_sid": "Sequence ID",
"notifications_revisions": "Revisions",
"notifications_priority_x": "Priority {{priority}}",
"notifications_new_indicator": "New notification",
"notifications_attachment_image": "Attachment image",

View File

@@ -23,9 +23,17 @@ const broadcastChannel = new BroadcastChannel("web-push-broadcast");
const addNotification = async ({ subscriptionId, message }) => {
const db = await dbAsync();
const populatedMessage = message;
if (!("mtime" in populatedMessage)) {
populatedMessage.mtime = message.time * 1000;
}
if (!("sid" in populatedMessage)) {
populatedMessage.sid = message.id;
}
await db.notifications.add({
...message,
...populatedMessage,
subscriptionId,
// New marker (used for bubble indicator); cannot be boolean; Dexie index limitation
new: 1,