From ba344241816ae56bd29350a2690da9a52a965a13 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski Date: Wed, 14 Jun 2023 17:03:08 +0200 Subject: [PATCH] make ts-strict happier --- .../notificationsettings/reconcileNotificationSettings.ts | 2 +- src/models/notificationsettings/toNotificationSettings.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/models/notificationsettings/reconcileNotificationSettings.ts b/src/models/notificationsettings/reconcileNotificationSettings.ts index 649c8ed490f..7fdd366e633 100644 --- a/src/models/notificationsettings/reconcileNotificationSettings.ts +++ b/src/models/notificationsettings/reconcileNotificationSettings.ts @@ -211,7 +211,7 @@ export function reconcileNotificationSettings( enabled: model.mentions.keywords, }); } - newKeywords.delete(rule.pattern); + newKeywords.delete(rule.pattern!); } for (const keyword of newKeywords) { changes.added.push({ diff --git a/src/models/notificationsettings/toNotificationSettings.ts b/src/models/notificationsettings/toNotificationSettings.ts index 40143cb8244..cfb28718c48 100644 --- a/src/models/notificationsettings/toNotificationSettings.ts +++ b/src/models/notificationsettings/toNotificationSettings.ts @@ -30,20 +30,20 @@ function shouldNotify(rules: (IPushRule | null | undefined | false)[]): boolean continue; } const actions = NotificationUtils.decodeActions(rule.actions); - if (actions.notify) { + if (actions !== null && actions.notify) { return true; } } return false; } -function determineSound(rules: (IPushRule | null | undefined | false)[]): string | null { +function determineSound(rules: (IPushRule | null | undefined | false)[]): string | undefined { for (const rule of rules) { if (rule === null || rule === undefined || rule === false || !rule.enabled) { continue; } const actions = NotificationUtils.decodeActions(rule.actions); - if (actions.notify && actions.sound !== undefined) { + if (actions !== null && actions.notify && actions.sound !== undefined) { return actions.sound; } } @@ -90,6 +90,6 @@ export function toNotificationSettings( ]), keywords: shouldNotify(contentRules), }, - keywords: contentRules.map((it) => it.pattern), + keywords: contentRules.map((it) => it.pattern!), }; }