From a2dbde3e24fbef0a9a75d05325171cefad63b5f2 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 23 Oct 2025 01:48:26 +1000 Subject: [PATCH] Notification Profiles: Normalize ids --- _locales/en/messages.json | 4 ++-- .../PreferencesNotificationProfiles.tsx | 4 +--- ts/services/storage.ts | 2 +- .../1490-lowercase-notification-profiles.ts | 21 +++++++++++++++++++ ts/sql/migrations/index.ts | 2 ++ 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 ts/sql/migrations/1490-lowercase-notification-profiles.ts diff --git a/_locales/en/messages.json b/_locales/en/messages.json index e9a1bb9212..7362cde53f 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -7261,7 +7261,7 @@ "description": "(Deleted 2025/10/15) Title text for modal where users select people or groups to include in the notification profile, who will still recevive nofications" }, "icu:NotificationProfiles--allowed-description": { - "messageformat": "Add people and groups who you want notications from when this profile is on", + "messageformat": "Add people and groups who you want notifications from when this profile is on", "description": "Description text for selecting people or groups that you still want to get notifications from when this profile is active" }, "icu:NotificationProfiles--allowed-add-label": { @@ -7433,7 +7433,7 @@ "description": "Label for pen icon next to notification profile's name on the edit page" }, "icu:NotificationProfiles--edit--allowed": { - "messageformat": "{allowedCount, plural, zero {No allowed notifications} one {One allowed notification} other {# allowed notifications}}", + "messageformat": "Allowed notifications", "description": "Header on notification profile edit page, showing number of contacts and groups in the allowed list" }, "icu:NotificationProfiles--edit--schedule-timing": { diff --git a/ts/components/PreferencesNotificationProfiles.tsx b/ts/components/PreferencesNotificationProfiles.tsx index 86b230ad40..dd8bd84ba9 100644 --- a/ts/components/PreferencesNotificationProfiles.tsx +++ b/ts/components/PreferencesNotificationProfiles.tsx @@ -1346,9 +1346,7 @@ function NotificationProfilesEditPage({ }} preferredBadgeSelector={preferredBadgeSelector} theme={theme} - title={i18n('icu:NotificationProfiles--edit--allowed', { - allowedCount: allowedMembersArray.length, - })} + title={i18n('icu:NotificationProfiles--edit--allowed')} />

diff --git a/ts/services/storage.ts b/ts/services/storage.ts index c4de252e7e..ad0b699324 100644 --- a/ts/services/storage.ts +++ b/ts/services/storage.ts @@ -1921,7 +1921,7 @@ async function processRemoteRecords( const { itemType, storageID, storageRecord } = item; if ( itemType === ITEM_TYPE.NOTIFICATION_PROFILE || - itemType === ITEM_TYPE.NOTIFICATION_PROFILE + itemType === ITEM_TYPE.CHAT_FOLDER ) { recordsNeedingAllContacts.push(item); return false; diff --git a/ts/sql/migrations/1490-lowercase-notification-profiles.ts b/ts/sql/migrations/1490-lowercase-notification-profiles.ts new file mode 100644 index 0000000000..ba2d058c0b --- /dev/null +++ b/ts/sql/migrations/1490-lowercase-notification-profiles.ts @@ -0,0 +1,21 @@ +// Copyright 2025 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import type { LoggerType } from '../../types/Logging.js'; +import type { WritableDB } from '../Interface.js'; +import { sql } from '../util.js'; + +export default function updateToSchemaVersion1490( + db: WritableDB, + logger: LoggerType +): void { + const [query, params] = sql` + DELETE FROM notificationProfiles + WHERE id != lower(id); + `; + const result = db.prepare(query).run(params); + + logger.info( + `Removed ${result.changes} notification profiles with non-lowercase ids` + ); +} diff --git a/ts/sql/migrations/index.ts b/ts/sql/migrations/index.ts index 9231dddb97..61626e80e8 100644 --- a/ts/sql/migrations/index.ts +++ b/ts/sql/migrations/index.ts @@ -124,6 +124,7 @@ import updateToSchemaVersion1450 from './1450-all-media.js'; import updateToSchemaVersion1460 from './1460-attachment-duration.js'; import updateToSchemaVersion1470 from './1470-kyber-triple.js'; import updateToSchemaVersion1480 from './1480-chat-folders-remove-duplicates.js'; +import updateToSchemaVersion1490 from './1490-lowercase-notification-profiles.js'; import { DataWriter } from '../Server.js'; @@ -1605,6 +1606,7 @@ export const SCHEMA_VERSIONS: ReadonlyArray = [ { version: 1460, update: updateToSchemaVersion1460 }, { version: 1470, update: updateToSchemaVersion1470 }, { version: 1480, update: updateToSchemaVersion1480 }, + { version: 1490, update: updateToSchemaVersion1490 }, ]; export class DBVersionFromFutureError extends Error {