Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(email-compose): send forwards with nothing typed above the message (#9280)
teo8ff6746c8252
diff --git a/apps/web/src/features/email-compose/primitives/reply-composer.ts b/apps/web/src/features/email-compose/primitives/reply-composer.tsindex 6119e5d531..ef28112fdc 100644--- a/apps/web/src/features/email-compose/primitives/reply-composer.ts+++ b/apps/web/src/features/email-compose/primitives/reply-composer.ts@@ -626,11 +626,17 @@ export function createReplyComposer();return null;}+ const recipients = form.recipients();if (!hasDraftContent(prepared.bodyText,form.subject(),- form.attachments.list().length+ form.attachments.list().length,+ // A forward's recipients are typed in, not derived from the thread,+ // so they keep a forward with no note of its own alive.+ form.replyType() === 'forward'+ ? recipients.to.length + recipients.cc.length + recipients.bcc.length+ : undefined)) {return null;diff --git a/apps/web/src/features/email-compose/primitives/reply-forward-kind.test.ts b/apps/web/src/features/email-compose/primitives/reply-forward-kind.test.tsindex 8461f852d6..a2078f055a 100644--- a/apps/web/src/features/email-compose/primitives/reply-forward-kind.test.ts+++ b/apps/web/src/features/email-compose/primitives/reply-forward-kind.test.ts@@ -10,6 +10,7 @@ import type {} from '../context/compose-capabilities';import { decodeBase64Utf8 } from '../core/decode-base64';import type { EmailRecipient } from '../core/email-recipient';+import type { LocalDraft } from '../core/local-draft';import type { ReplyType } from '../core/reply-type';import { createComposeContext } from '../tests/capabilities';import { createEmailEditor } from '../tests/editor';@@ -196,6 +197,62 @@ it.each(providers)(});+it.each(providers)(+ 'sends a %s forward with nothing typed above the forwarded message',+ async (provider) => {+ const context = inboxContext(provider);+ context.delivery.queueActive = () => true;+ context.drafts.saveLocalDraft = vi.fn(+ async (input): Promise<LocalDraft> => ({+ key: input.clientHandles?.draftId ?? 'draft',+ draftId: input.clientHandles?.draftId ?? 'draft',+ threadId: input.clientHandles?.threadId ?? 'thread',+ accountId: 'owner',+ generation: 'local-generation',+ revision: 1,+ acknowledgedRevision: 0,+ status: 'dirty',+ updatedAt: Date.now(),+ content: input.draft,+ attachments: [],+ })+ );+ const actions = cardActions();+ const reply = mountReplyComposer(+ context,+ () => parent,+ {},+ {+ replyRequest: actions,+ }+ );+ try {+ reply.edit('');+ await actions.click('forward');+ reply.form.setRecipients('to', [teammate]);+ await reply.sendEmail();++ expect(context.notices.feedback.failure).not.toHaveBeenCalled();+ expect(context.delivery.sendMessage).toHaveBeenCalledOnce();+ // The send queue refuses a send without the draft it delivers.+ expect(context.delivery.sendMessage).toHaveBeenCalledWith(+ expect.objectContaining({+ clientHandles: expect.objectContaining({+ draftId: expect.any(String),+ }),+ expectedLocalVersion: expect.anything(),+ })+ );+ const sent = delivered(context);+ expect(sent.to).toEqual(['[email protected]']);+ expect(sent.body).toContain('Forwarded message');+ expect(sent.body).toContain('Original message text');+ } finally {+ reply.dispose();+ }+ }+);+it.each(providers)('forwards a %s reply that was showing its quote with the forwarded message',async (provider) => {