Skip to content

Commit

Permalink
Include toLowerCase check for wallet address comparisons in notificat…
Browse files Browse the repository at this point in the history
…ions settings functions
  • Loading branch information
jinchung committed Oct 17, 2024
1 parent 320ae80 commit 8ef7756
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/notifications/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ import { publishWalletSettings } from '@/notifications/settings/firebase';
export const removeNotificationSettingsForWallet = async (address: string): Promise<void> => {
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 });
};
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8ef7756

Please sign in to comment.