From 8ef775678054c76f0342e2450352dbeff9414f4f Mon Sep 17 00:00:00 2001 From: jinchung Date: Wed, 16 Oct 2024 13:41:13 -0400 Subject: [PATCH] Include toLowerCase check for wallet address comparisons in notifications settings functions --- src/notifications/settings/settings.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/notifications/settings/settings.ts b/src/notifications/settings/settings.ts index 8f6b070e56b..d430dbb515f 100644 --- a/src/notifications/settings/settings.ts +++ b/src/notifications/settings/settings.ts @@ -23,13 +23,17 @@ import { publishWalletSettings } from '@/notifications/settings/firebase'; export const removeNotificationSettingsForWallet = async (address: string): Promise => { const walletSettings = getAllWalletNotificationSettingsFromStorage(); const globalSettings = getAllGlobalNotificationSettingsFromStorage(); - const settingsForWallet = walletSettings.find((wallet: WalletNotificationSettings) => wallet.address === address); + const settingsForWallet = walletSettings.find( + (wallet: WalletNotificationSettings) => wallet.address.toLowerCase() === address.toLowerCase() + ); if (!settingsForWallet) { return; } - const newWalletSettings = walletSettings.filter((wallet: WalletNotificationSettings) => wallet.address !== address); + const newWalletSettings = walletSettings.filter( + (wallet: WalletNotificationSettings) => wallet.address.toLowerCase() !== address.toLowerCase() + ); publishAndSaveNotificationSettings({ globalSettings, walletSettings: newWalletSettings }); }; @@ -72,7 +76,7 @@ export async function toggleTopicForWallet(address: string, topic: WalletNotific const walletSettings = getAllWalletNotificationSettingsFromStorage(); const globalSettings = getAllGlobalNotificationSettingsFromStorage(); const newSettings = walletSettings.map(walletSetting => { - if (walletSetting.address !== address) { + if (walletSetting.address.toLowerCase() !== address.toLowerCase()) { return walletSetting; } return {