From f2d49f4060a556668cb3ace9615ae3762739fd7d Mon Sep 17 00:00:00 2001 From: lucamzanon Date: Wed, 30 Sep 2026 08:44:38 +0200 Subject: [PATCH] fix: carry the inbox-only choice into bulk push and use the shared icons Upstream now requires inboxOnly when enabling push and replaced lucide-react with the shared icon module; the bulk path had neither. --- components/settings/multi-account-push.tsx | 5 +++-- lib/__tests__/web-push.test.ts | 4 ++-- lib/web-push.ts | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/components/settings/multi-account-push.tsx b/components/settings/multi-account-push.tsx index fb0038d20..cb025b3e7 100644 --- a/components/settings/multi-account-push.tsx +++ b/components/settings/multi-account-push.tsx @@ -2,11 +2,12 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranslations } from 'next-intl'; -import { Loader2 } from 'lucide-react'; +import { Loader2 } from '@/components/icons'; import { Button } from '@/components/ui/button'; import { SettingsSection } from './settings-section'; import { useAccountStore } from '@/stores/account-store'; import { useAuthStore } from '@/stores/auth-store'; +import { useSettingsStore } from '@/stores/settings-store'; import { disableWebPush, enableWebPushForAccounts, isWebPushEnabled, isWebPushSupported } from '@/lib/web-push'; /** @@ -55,7 +56,7 @@ export function MultiAccountPushSettings({ relayBaseUrl }: { relayBaseUrl?: stri if (action === 'enable') { const outcome = await enableWebPushForAccounts( targets.map(a => ({ accountId: a.id, client: auth.getClientForAccount(a.id)!, accountLabel: a.username })), - { relayBaseUrl }, + { relayBaseUrl, inboxOnly: useSettingsStore.getState().pushNotifyInboxOnly }, ); setNotice(outcome.failed.length ? t('result_partial', { enabled: outcome.enabled.length, failed: outcome.failed.length }) diff --git a/lib/__tests__/web-push.test.ts b/lib/__tests__/web-push.test.ts index f3bbc0002..03b450ec7 100644 --- a/lib/__tests__/web-push.test.ts +++ b/lib/__tests__/web-push.test.ts @@ -617,7 +617,7 @@ describe('enableWebPushForAccounts', () => { const result = await enableWebPushForAccounts([ { accountId: 'a', client: first, accountLabel: 'one' }, { accountId: 'b', client: second, accountLabel: 'two' }, - ], { relayBaseUrl: RELAY }); + ], { relayBaseUrl: RELAY, inboxOnly: false }); expect(result.enabled).toEqual(['a', 'b']); expect(result.failed).toEqual([]); @@ -637,7 +637,7 @@ describe('enableWebPushForAccounts', () => { const result = await enableWebPushForAccounts([ { accountId: 'a', client: first }, { accountId: 'b', client: second }, - ], { relayBaseUrl: RELAY }); + ], { relayBaseUrl: RELAY, inboxOnly: false }); expect(result.enabled).toEqual([]); expect(result.failed.map(f => f.accountId)).toEqual(['a', 'b']); diff --git a/lib/web-push.ts b/lib/web-push.ts index 23f53a0a5..f5c51acf7 100644 --- a/lib/web-push.ts +++ b/lib/web-push.ts @@ -791,7 +791,8 @@ export interface BulkWebPushResult { */ export async function enableWebPushForAccounts( targets: BulkWebPushTarget[], - options: { relayBaseUrl?: string; forceRecreate?: boolean } = {}, + // inboxOnly mirrors settings-store's pushNotifyInboxOnly, as for a single account. + options: { relayBaseUrl?: string; forceRecreate?: boolean; inboxOnly: boolean }, ): Promise { const result: BulkWebPushResult = { enabled: [], failed: [] }; let browserRefusal: unknown; @@ -806,6 +807,7 @@ export async function enableWebPushForAccounts( relayBaseUrl: options.relayBaseUrl, accountLabel: target.accountLabel, forceRecreate: options.forceRecreate, + inboxOnly: options.inboxOnly, }); result.enabled.push(target.accountId); } catch (error) {