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): join a Macro call from the mention card instead of its raw link (#9241)
gbirman5dc7f4880a77
diff --git a/apps/web/src/features/calendar-notes/meeting-reference.tsx b/apps/web/src/features/calendar-notes/meeting-reference.tsxindex f57fe956fd..5c77793148 100644--- a/apps/web/src/features/calendar-notes/meeting-reference.tsx+++ b/apps/web/src/features/calendar-notes/meeting-reference.tsx@@ -126,6 +126,7 @@ export function MeetingReference(props: {<CalendarEventPreviewDetailsevent={current()}mentionedEventId={props.link.eventId}+ onJoin={() => setDetailsOpen(false)}sharedActions={resolved()?.sharedActions}/>)}diff --git a/apps/web/src/lib/core/component/DocumentPreview.test.tsx b/apps/web/src/lib/core/component/DocumentPreview.test.tsxindex cc695d15f3..72bc14b687 100644--- a/apps/web/src/lib/core/component/DocumentPreview.test.tsx+++ b/apps/web/src/lib/core/component/DocumentPreview.test.tsx@@ -234,6 +234,84 @@ describe('calendar mention preview card', () => {});});+describe('calendar mention card for a Macro call', () => {+ const callUrl = 'https://macro.com/app/meet/join/abcdefghijklmnop';+ const call = {+ location: callUrl,+ description: `<p>Agenda</p><p>Join Macro call: <a href="${callUrl}">${callUrl}</a></p>`,+ };++ it('joins from one row instead of printing the link', () => {+ mocks.item = calendarItem(call);+ const view = renderCard();++ expect(view.container.textContent).not.toContain('/meet/join/');+ expect(view.container.textContent).toContain('Agenda');++ fireEvent.click(screen.getByRole('button', { name: 'Join Macro call' }));+ expect(mocks.openExternalUrl).toHaveBeenCalledWith(callUrl);+ });++ it('keeps a typed location beside the join row', () => {+ mocks.item = calendarItem({ ...call, location: 'Room 2' });+ const view = renderCard();++ expect(view.container.textContent).toContain('Room 2');+ expect(+ screen.getByRole('button', { name: 'Join Macro call' })+ ).toBeTruthy();+ });++ // Channel shares carry the meeting, not a way into its call: the .ics+ // download and the imported snapshot leave the link out the same way.+ it('gives a channel-shared meeting neither the link nor a join row', () => {+ mocks.item = calendarItem({ ...call, viewerEventId: null });+ const view = renderCard();++ expect(view.container.textContent).not.toContain('/meet/join/');+ expect(view.container.textContent).toContain('Agenda');+ expect(+ screen.queryByRole('button', { name: 'Join Macro call' })+ ).toBeNull();+ });++ it('leaves a Google Meet link where it was', () => {+ const meetUrl = 'https://meet.google.com/abc-defg-hij';+ mocks.item = calendarItem({ location: meetUrl });+ const view = renderCard();++ expect(view.container.textContent).toContain(meetUrl);+ expect(+ screen.queryByRole('button', { name: 'Join Macro call' })+ ).toBeNull();+ });++ // Native apps route the link in-app, behind the sheet.+ it('closes the phone sheet once Join has left it', async () => {+ mocks.item = calendarItem(call);+ const onOpenChange = vi.fn();+ render(() => (+ <DocumentPreviewSheet+ open+ onOpenChange={onOpenChange}+ documentInfo={{+ id: 'mentioned-event',+ type: 'calendar',+ params: {},+ isOpenable: true,+ }}+ />+ ));++ fireEvent.click(+ await screen.findByRole('button', { name: 'Join Macro call' })+ );++ expect(mocks.openExternalUrl).toHaveBeenCalledWith(callUrl);+ expect(onOpenChange).toHaveBeenCalledWith(false);+ });+});+describe('calendar mention card for a meeting the viewer holds', () => {it.each([['snapshot', 'Your copy is on your calendar'],diff --git a/apps/web/src/lib/core/component/DocumentPreview.tsx b/apps/web/src/lib/core/component/DocumentPreview.tsxindex a5d40739f8..78cf178cef 100644--- a/apps/web/src/lib/core/component/DocumentPreview.tsx+++ b/apps/web/src/lib/core/component/DocumentPreview.tsx@@ -2,6 +2,10 @@ import {parseMacroAppLink,sanitizeCalendarDescription,} from '@app/features/calendar/utils/calendar-description';+import {+ calendarMacroCallUrl,+ removeCalendarMacroCall,+} from '@app/features/calendar/utils/macro-call-link';import { SharedEventActions } from '@app/features/calendar-view/components/SharedEventActions';import {type CalendarMentionTarget,@@ -43,6 +47,7 @@ import { parseLocalDate } from '@core/util/local-date';import { matches } from '@core/util/match';import { buildSimpleEntityUrl, openExternalUrl } from '@core/util/url';import MacroEmbed from '@icon/macro-embed.svg';+import ArrowSquareOutIcon from '@icon/system/regular/arrow-square-out.svg';import CollapseInlinePreview from '@icon/system/regular/arrows-in-line-horizontal.svg';import ExpandInlinePreview from '@icon/system/regular/arrows-out-line-horizontal.svg';import CalendarCheckIcon from '@icon/system/regular/calendar-check.svg';@@ -62,6 +67,7 @@ import TextAlignLeftIcon from '@icon/system/regular/text-align-left.svg';import TextTIcon from '@icon/system/regular/text-t.svg';import TrashSimple from '@icon/system/regular/trash-simple.svg';import UsersIcon from '@icon/system/regular/users.svg';+import VideoCameraIcon from '@icon/system/regular/video-camera.svg';import {isAccessiblePreviewItem,isCalendarEventPreviewItem,@@ -372,13 +378,22 @@ export function CalendarEventPreviewDetails(props: {mentionedEventId: string;/** Opens the viewer's own copy; absent where the card cannot open it. */onOpen?: (event: MouseEvent) => void;+ /** Runs once Join has left the card; native apps join in-app, behind it. */+ onJoin?: () => void;/** Team-calendar projections have no channel-share mutation capabilities. */sharedActions?: boolean;}) {const organizer = () =>props.event.organizerName ?? props.event.organizerEmail;+ const macroMeetingUrl = () => calendarMacroCallUrl(props.event);+ // A channel share exposes the meeting, not a way into its call.+ const joinableMeetingUrl = () =>+ props.event.viewerEventId ? macroMeetingUrl() : undefined;+ const eventContent = createMemo(() =>+ removeCalendarMacroCall(props.event, macroMeetingUrl())+ );const descriptionHtml = () =>- sanitizeCalendarDescription(props.event.description ?? '');+ sanitizeCalendarDescription(eventContent().description);// Opening a Macro link reads the split layout from context, so the handler// keeps this component's owner.const openDescriptionLink = createCallback((event: MouseEvent) => {@@ -425,7 +440,25 @@ export function CalendarEventPreviewDetails(props: {</MetadataInfo>)}</Show>- <Show when={props.event.location}>+ <Show when={joinableMeetingUrl()}>+ {(url) => (+ <MetadataInfo icon={VideoCameraIcon}>+ <Button+ variant="secondary"+ size="xs"+ onClick={(event) => {+ event.stopPropagation();+ openExternalUrl(url());+ props.onJoin?.();+ }}+ >+ Join Macro call+ <ArrowSquareOutIcon class="size-3.5 shrink-0" />+ </Button>+ </MetadataInfo>+ )}+ </Show>+ <Show when={eventContent().location.trim()}>{(location) => (<MetadataInfo icon={MapPinIcon}><span class="truncate">{location()}</span>@@ -1062,6 +1095,7 @@ export function DocumentPreviewContent(props: DocumentPreviewContentProps) {): undefined}+ onJoin={props.onOpened}/>)}</Show>diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.mdindex bd353331e5..27e4fc0f11 100644--- a/docs/agent-guide/calendar.md+++ b/docs/agent-guide/calendar.md@@ -891,7 +891,10 @@ it by posting the chip. It asks whether to share with the channel, and a yes inwrites the same channel grant. Private and confidential events are never shared this way.Every calendar mention's hover card shows the schedule, location, organizer and attendeecount, plus the first lines of the event description (its links open), and no last-updated-byline. A mention of a meeting that was deleted or cancelled reads `Deleted`; clicking it (a tap+byline. A Macro call's generated `Join Macro call` line and a location that is only its link are+left out, as in event details, and a viewer holding the meeting gets one `Join Macro call` button+below the schedule, which closes the phone sheet as it joins. A read-only channel share gets no+join button, since a share never carries the join link. A mention of a meeting that was deleted or cancelled reads `Deleted`; clicking it (a tapon a phone, which opens a sheet) shows `This event was deleted or cancelled.`, like a sharedevent's card, instead of doing nothing. When the mention names someone else's copy of a meeting the viewer also holds (a sharedevent they added or were invited to, or a meeting someone else mentioned), the card says how: