diff --git a/hooks/use-keep-file-offline.ts b/hooks/use-keep-file-offline.ts index 31521bec3..efcec38ad 100644 --- a/hooks/use-keep-file-offline.ts +++ b/hooks/use-keep-file-offline.ts @@ -30,7 +30,7 @@ export function useKeepFileOffline(client: IJMAPClient | null | undefined) { const t = useTranslations('offlineStorage'); const account = useAuthStore((s) => s.activeAccountId); const { active, pinned, pin, unpin } = useKeptFiles(account); - const own = client?.getAccountId() ?? ''; + const own = client?.getAccountId?.() ?? ''; const keptOffline = useMemo(() => new Set(pinned.map((file) => (file.jmap === own ? file.id : `${file.jmap}:${file.id}`))), [pinned, own]); diff --git a/lib/offline/__tests__/outbox.test.ts b/lib/offline/__tests__/outbox.test.ts index 1ce7a5c4c..64579f533 100644 --- a/lib/offline/__tests__/outbox.test.ts +++ b/lib/offline/__tests__/outbox.test.ts @@ -426,6 +426,7 @@ describe('wiping offline data', () => { useAuthStore.setState({ client: client as never, activeAccountId: 'acc' }); writeEnabled(['acc']); stop = startOfflineMode(); + usePolicyStore.getState().setPolicySubject({ email: 'alice@example.org', groups: [] }); usePolicyStore.setState({ policy: { ...usePolicyStore.getState().policy, organisation: { ...DEFAULT_ORGANISATION_POLICY, devices: { ...DEFAULT_ORGANISATION_POLICY.devices, noOffline: true } } } }); enforcePolicy(); await vi.waitFor(async () => expect(useOfflineStore.getState().enabled).toEqual([])); diff --git a/lib/offline/__tests__/review-fixes.test.ts b/lib/offline/__tests__/review-fixes.test.ts index c7e4579e5..451caa937 100644 --- a/lib/offline/__tests__/review-fixes.test.ts +++ b/lib/offline/__tests__/review-fixes.test.ts @@ -368,7 +368,7 @@ describe('what a sign-out would delete', () => { }); it('answers with the last known count when the store hangs', async () => { - useOfflineStore.setState({ outbox: [{ id: 1, account: 'acc', createdAt: 1, subject: 'A', to: [], status: 'waiting' }] as never, pendingChanges: 2 }); + useOfflineStore.setState({ outbox: [{ id: 1, account: 'acc', createdAt: 1, subject: 'A', to: [], status: 'waiting' }] as never, changesBy: { acc: 2 } }); const hung: Array<(error: Error) => void> = []; vi.spyOn(store, 'area').mockImplementation(() => new Promise((_resolve, reject) => { hung.push(reject); })); expect(await unsentCount('acc', 10)).toEqual({ messages: 1, changes: 2 });