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(crm): load contact files without an email address (#9613)
gbirman7a348b666269
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 5232622fdf..6d2e95100b 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -433,6 +433,8 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription toRecord search fills the row beside filters with header spacing; section creationreplaces the default floating dock action through FloatRegion. See`src/features/crm/README.md` and `docs/agent-guide/crm.md` at the repo root.+ Keep Files scoped to the contact when its optional email is absent; emit an+ email-attachment participant literal only for a present address.Put Archive beside Copy link for visible CRM records; put the Archived chip andseparate borderless Restore action in the identity heading for archived records.Keep explanations on the chip and retain company-only Email sharing controls.diff --git a/apps/web/src/features/crm/queries/record-items.test.ts b/apps/web/src/features/crm/queries/record-items.test.tsindex d5c08ff763..9aeb95a56d 100644--- a/apps/web/src/features/crm/queries/record-items.test.ts+++ b/apps/web/src/features/crm/queries/record-items.test.ts@@ -8,6 +8,51 @@ import {} from './record-items';describe('CRM record item queries', () => {+ it.each([undefined, null, ''])(+ 'keeps files scoped to the contact when its email is %s',+ (email) => {+ const body = JSON.parse(+ JSON.stringify(+ recordFilesBody({+ type: 'contact',+ id: '00000000-0000-4000-8000-000000000001',+ email,+ })+ )+ );++ expect(body.df).toEqual({+ '&': [+ { '!': { l: { dst: 'task' } } },+ {+ l: {+ crm: { contact: '00000000-0000-4000-8000-000000000001' },+ },+ },+ ],+ });+ expect(body.ef).toEqual({ l: { ThreadId: NIL_UUID } });+ expect(body.ccf).toEqual({ l: { id: NIL_UUID } });+ }+ );++ it('keeps a company without domains scoped to its associations', () => {+ const body = recordFilesBody({+ type: 'company',+ id: '00000000-0000-4000-8000-000000000002',+ domains: [],+ });++ expect(body.df).toEqual({+ '&': [+ { '!': { l: { dst: 'task' } } },+ {+ l: { crm: { company: '00000000-0000-4000-8000-000000000002' } },+ },+ ],+ });+ });+it('lists non-task files associated with a company or attached to emails with its domains', () => {const body = recordFilesBody({type: 'company',diff --git a/apps/web/src/features/crm/queries/record-items.ts b/apps/web/src/features/crm/queries/record-items.tsindex 22b2d49870..f7d405409f 100644--- a/apps/web/src/features/crm/queries/record-items.ts+++ b/apps/web/src/features/crm/queries/record-items.ts@@ -45,9 +45,9 @@ const participants = (scope: CrmRecordScope): AstNode[] =>.with({ type: 'company' }, ({ domains }) =>domains.map((domain) => leaf({ eap: { Domain: domain } })))- .with({ type: 'contact' }, ({ email }) => [- leaf({ eap: { Complete: email } }),- ])+ .with({ type: 'contact' }, ({ email }) =>+ email ? [leaf({ eap: { Complete: email } })] : []+ ).exhaustive(() => []);/**diff --git a/docs/agent-guide/crm.md b/docs/agent-guide/crm.mdindex 900b78cb8e..06360d84d1 100644--- a/docs/agent-guide/crm.md+++ b/docs/agent-guide/crm.md@@ -333,7 +333,10 @@ A contact has the same layout with `Overview`, `Emails`, `Files`, `Tasks`, `Callinteracted`, followed by the contact's Pipelines cards. Its Files, Tasks, Calls,and References show items associated with the contact itself (its `Contacts`property or an @mention of it), not everything associated with its company;-Files also includes attachments of emails with its address. Tasks created from a+Files also includes attachments of emails with its address. Contacts without an+email still list their associated non-task files; they send no email-attachment+participant filter. Verify both an empty list and linked files on desktop and phone.+Tasks created from acontact also reference its company. The side panel contains References, with noempty Sharing section.