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(calendar): name a shared calendar organizer instead of its address (#6228)
gbirmandff3bc00c66b
diff --git a/apps/web/src/features/entity/composed/list-entity/calendar.test.tsx b/apps/web/src/features/entity/composed/list-entity/calendar.test.tsxnew file mode 100644index 0000000000..a368f39651--- /dev/null+++ b/apps/web/src/features/entity/composed/list-entity/calendar.test.tsx@@ -0,0 +1,68 @@+import { render, screen } from '@solidjs/testing-library';+import { describe, expect, it, vi } from 'vitest';+import type { CalendarEventEntity } from '../../types/entity';+import { CalendarEventWhen } from './calendar';++vi.mock('@core/user', () => ({+ emailToMacroId: (email: string) =>+ email.includes('@') ? `macro|${email}` : undefined,+ getDisplayName: (id: string) =>+ id === 'macro|[email protected]'+ ? 'Jacob Beckerman'+ : id.replace(/^macro\|/, ''),+}));+vi.mock('@core/component/UserIcon', () => ({ UserIcon: () => null }));+vi.mock('../../entity', () => ({ Entity: {} }));++function event(+ organizer: CalendarEventEntity['organizer']+): CalendarEventEntity {+ return {+ id: 'event',+ name: 'Out of office',+ ownerId: 'macro|[email protected]',+ type: 'calendar_event',+ status: 'confirmed',+ isReadOnly: false,+ organizer,+ time: {+ kind: 'timed',+ startsAt: '2026-08-14T04:00:00Z',+ endsAt: '2026-08-15T04:00:00Z',+ },+ };+}++describe('CalendarEventWhen organizer', () => {+ it('names a shared calendar by the name the source supplied, not its address', () => {+ render(() => (+ <CalendarEventWhen+ entity={event({+ name: 'Macro Vacation',+ email: '[email protected]',+ })}+ />+ ));++ expect(screen.getByText('Macro Vacation')).toBeTruthy();+ expect(screen.queryByText(/group\.calendar\.google\.com/)).toBeNull();+ });++ it('prefers the Macro profile name when the organizer has one', () => {+ render(() => (+ <CalendarEventWhen+ entity={event({ name: 'jacob', email: '[email protected]' })}+ />+ ));++ expect(screen.getByText('Jacob Beckerman')).toBeTruthy();+ });++ it('falls back to the email when the organizer has neither a profile nor a name', () => {+ render(() => (+ <CalendarEventWhen entity={event({ email: '[email protected]' })} />+ ));++ expect(screen.getByText('[email protected]')).toBeTruthy();+ });+});diff --git a/apps/web/src/features/entity/composed/list-entity/calendar.tsx b/apps/web/src/features/entity/composed/list-entity/calendar.tsxindex 86782bf338..7322600cbb 100644--- a/apps/web/src/features/entity/composed/list-entity/calendar.tsx+++ b/apps/web/src/features/entity/composed/list-entity/calendar.tsx@@ -96,12 +96,15 @@ function organizerIconProps(/** Organizer display: the Macro profile name when resolved, else the source's* own name, else the email. Read reactively so it fills in when the user's- * name cache resolves. */+ * name cache resolves. The profile lookup falls back to the email for an+ * address without a profile, such as a shared calendar's, so that fallback+ * must not win over the name the source supplied. */function organizerName(entity: CalendarEventEntity): string {const email = entity.organizer?.email;const macroId = email ? emailToMacroId(email) : undefined;const resolved = macroId ? getDisplayName(macroId).trim() : '';- return resolved || entity.organizer?.name || email || '';+ const profileName = resolved && resolved !== email ? resolved : '';+ return profileName || entity.organizer?.name || email || '';}const Dot = () => <span class="shrink-0 text-ink/30">·</span>;