Rename to sequence_id

This commit is contained in:
binwiederhier
2026-01-08 14:27:18 -05:00
parent fd8cd5ca91
commit 1ab7ca876c
13 changed files with 125 additions and 121 deletions

View File

@@ -8,7 +8,7 @@ import { dbAsync } from "../src/app/db";
import { toNotificationParams, icon, badge } from "../src/app/notificationUtils";
import initI18n from "../src/app/i18n";
import { messageWithSID } from "../src/app/utils";
import { messageWithSequenceId } from "../src/app/utils";
/**
* General docs for service workers and PWAs:
@@ -27,14 +27,15 @@ const addNotification = async ({ subscriptionId, message }) => {
// Note: SubscriptionManager duplicates this logic, so if you change it here, change it there too
// Delete existing notification with same SID (if any)
if (message.sid) {
await db.notifications.where({ subscriptionId, sid: message.sid }).delete();
// Delete existing notification with same sequence ID (if any)
const sequenceId = message.sequence_id || message.id;
if (sequenceId) {
await db.notifications.where({ subscriptionId, sequenceId }).delete();
}
// Add notification to database
await db.notifications.add({
...messageWithSID(message),
...messageWithSequenceId(message),
subscriptionId,
new: 1, // New marker (used for bubble indicator); cannot be boolean; Dexie index limitation
});