From 6ec867b4e08e11e438d819a6dd4159909acad086 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:16:44 +0100 Subject: [PATCH] fix: count a pop-out's undo send from the delay the user picked --- .../popout/__tests__/popout-compose-app.test.tsx | 10 ++++++++++ components/popout/popout-compose-app.tsx | 11 +++++++---- lib/outgoing/send-progress-toast.ts | 15 +++++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/components/popout/__tests__/popout-compose-app.test.tsx b/components/popout/__tests__/popout-compose-app.test.tsx index 737e95948..f1bfe6f70 100644 --- a/components/popout/__tests__/popout-compose-app.test.tsx +++ b/components/popout/__tests__/popout-compose-app.test.tsx @@ -7,6 +7,7 @@ import { useAuthStore } from '@/stores/auth-store'; import { useEmailStore } from '@/stores/email-store'; import { useIdentityStore } from '@/stores/identity-store'; import { usePluginStore } from '@/stores/plugin-store'; +import { useSettingsStore } from '@/stores/settings-store'; import { emailHooks } from '@/lib/plugin-hooks'; // The composer's window: when it tells the opening window to let go, and what @@ -614,6 +615,15 @@ describe('a send held for undo', () => { expect(sent?.notice.releasesAt).toBe(sendAt); }); + // The server's time runs past the delay: "Sending in 6 seconds" for 5 s. + it('never counts from more than the delay the user picked', async () => { + const before = useSettingsStore.getState().sendDelaySeconds; + useSettingsStore.setState({ sendDelaySeconds: 5 } as never); + await sendFromWindow(5.8); + expect(screen.getByTestId('popout-sending')).toHaveAttribute('data-seconds', '5'); + useSettingsStore.setState({ sendDelaySeconds: before } as never); + }); + // compose-24: the window sat with a greyed Send until the server answered. it('says "Sending…" as soon as Send goes through, before the server answers', async () => { let answer!: () => void; diff --git a/components/popout/popout-compose-app.tsx b/components/popout/popout-compose-app.tsx index c8145e2d2..36e65f7c6 100644 --- a/components/popout/popout-compose-app.tsx +++ b/components/popout/popout-compose-app.tsx @@ -10,6 +10,8 @@ import { useAuthStore } from "@/stores/auth-store"; import { useEmailStore } from "@/stores/email-store"; import { usePluginStore } from "@/stores/plugin-store"; import { toast } from "@/stores/toast-store"; +import { useSettingsStore } from "@/stores/settings-store"; +import { secondsUntilSend } from "@/lib/outgoing/send-progress-toast"; import { formatRejectedRecipients } from "@/lib/jmap/client"; import { debug } from "@/lib/debug"; import { composerSendOptions } from "@/lib/outgoing/composer-send-options"; @@ -68,9 +70,9 @@ interface ReopenTarget { } /** "Sending…" or "Sent", where the composer was, with the send icon. */ -function SendStatus({ text, children }: { text: string; children?: React.ReactNode }) { +function SendStatus({ text, seconds, children }: { text: string; seconds?: number; children?: React.ReactNode }) { return ( -
+