Here they are.
', + showCc: false, + showBcc: false, + selectedIdentityId: 'id-me', + subAddressTag: '', + mode: 'compose' as const, + draftId: 'draft-3', +}; + +const sendButton = () => screen.getAllByTestId('composer-send')[0] as HTMLButtonElement; + +describe('a send that fails after the host closed the composer', () => { + it('hands the message back to the host', async () => { + const onSend = vi.fn().mockRejectedValue(new Error('refused')); + const onSendFailed = vi.fn(); + render(Here they are.
', + draftId: 'draft-3', + }); + }); + + it('says nothing to the host when the message went out', async () => { + const onSend = vi.fn().mockResolvedValue(undefined); + const onSendFailed = vi.fn(); + render(Thanks!
' diff --git a/components/email/email-composer.tsx b/components/email/email-composer.tsx index 6c8e8935e..c93e6c7b9 100644 --- a/components/email/email-composer.tsx +++ b/components/email/email-composer.tsx @@ -55,6 +55,8 @@ import { matchesCombo } from "@/lib/plugin-sandbox/shortcuts"; import { cn, formatFileSize, formatDateTime, generateUUID } from "@/lib/utils"; import { forwardRecipientLines } from "@/lib/quote-header"; import { ScheduleSendDialog } from "./schedule-send-dialog"; +import { SendWarningsDialog, type SendWarning } from "./send-warnings-dialog"; +import { QuickSaveTemplateDialog } from "@/components/templates/quick-save-template-dialog"; import { debug } from "@/lib/debug"; import { toast } from "@/stores/toast-store"; import { useContextMenu, isContextMenuKey } from "@/hooks/use-context-menu"; @@ -370,6 +372,11 @@ interface EmailComposerProps { /** The id plugins know this composer by, for onAfterEmailSend. */ composerId?: string; }) => void | false | Promise{template.subject}
@@ -131,13 +132,15 @@ export function TemplatePicker({ isOpen, onClose, onSelect, accountId }: Templat ); - const renderSection = (title: string, items: EmailTemplate[], source: TemplateSource) => { + const renderSection = (title: string, items: EmailTemplate[], source: TemplateSource, withHeading = true) => { if (items.length === 0) return null; return (