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 Google Meet with the connected account (#8429)
gbirman794dc0b41d49
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 4a4ba6b469..695b6fb611 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -110,6 +110,9 @@ ownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.- Keep native booking exit navigation in the route shell, outside page loading boundaries, and use the router so the native hash route stays intact.- Diagnose native full reloads with `native_webview_started` and native launch/termination/update counters; termination coverage is iOS/macOS only, and a pageview alone also includes SPA navigation. See `tauri/src-tauri/README.md`.- All API/network calls live in service-clients.+- Add Google Meet account hints only to join actions using the displayed calendar's+ connected email; keep stored and copied conference links unchanged. See the+ [calendar walkthrough](../../docs/agent-guide/calendar.md).- Route explicit call exits using the server's `callEnded` result: ended callsopen their record; ongoing channel and scheduled calls return to the channeland Calendar. Preserve the session ID before disconnecting.diff --git a/apps/web/src/features/calendar-view/components/CalendarSearch.tsx b/apps/web/src/features/calendar-view/components/CalendarSearch.tsxindex 75105da56d..010ee53232 100644--- a/apps/web/src/features/calendar-view/components/CalendarSearch.tsx+++ b/apps/web/src/features/calendar-view/components/CalendarSearch.tsx@@ -8,7 +8,10 @@ import {} from '@app/features/calendar/types';import { parseLocalDate } from '@app/features/calendar/utils/calendar-date';import { isCalendarRangeSupported } from '@app/features/calendar/utils/calendar-supported-range';-import { safeConferenceUrl } from '@app/features/calendar/utils/conference-link';+import {+ conferenceJoinUrl,+ safeConferenceUrl,+} from '@app/features/calendar/utils/conference-link';import {calendarMacroCallUrl,macroCallUrl,@@ -92,6 +95,7 @@ type CalendarMeetingLink = {type CalendarSearchEventDetails = {conferenceUrl?: string;+ accountEmail?: string;description?: string;location?: string;};@@ -478,6 +482,7 @@ function CalendarSearchControl(props: {});byOccurrence.set(searchEventKey(event.eventId, event.occurrenceKey), {conferenceUrl: event.conferenceUrl,+ accountEmail: event.calendar.emailAddress,description: event.description,location: event.location,});@@ -922,7 +927,13 @@ function CalendarSearchControl(props: {: 'bg-hover text-ink not-touch:not-disabled:hover:bg-active not-touch:not-disabled:hover:text-ink')}onClick={() =>- openExternalUrl(link().url)+ openExternalUrl(+ conferenceJoinUrl(+ link().url,+ detailsForEvent(event)+ ?.accountEmail+ )+ )}><VideoCameraIcon class="size-3.5" />diff --git a/apps/web/src/features/calendar/components/EventDetails.tsx b/apps/web/src/features/calendar/components/EventDetails.tsxindex 09f850f610..0a9e337fde 100644--- a/apps/web/src/features/calendar/components/EventDetails.tsx+++ b/apps/web/src/features/calendar/components/EventDetails.tsx@@ -51,7 +51,7 @@ import {parseMacroAppLink,sanitizeCalendarDescription,} from '../utils/calendar-description';-import { safeConferenceUrl } from '../utils/conference-link';+import { conferenceJoinUrl, safeConferenceUrl } from '../utils/conference-link';import {type CalendarPerson,eventAttribution,@@ -601,7 +601,11 @@ export function EventDetails(props: {variant="ghost"size="sm"class="h-8 min-w-0 bg-hover text-ink not-touch:not-disabled:hover:bg-active [&_svg]:size-3.5!"- onClick={() => openExternalUrl(url())}+ onClick={() =>+ openExternalUrl(+ conferenceJoinUrl(url(), props.event.calendar.emailAddress)+ )+ }>{conferenceLabel()}<ArrowSquareOutIcon />diff --git a/apps/web/src/features/calendar/utils/conference-link.test.ts b/apps/web/src/features/calendar/utils/conference-link.test.tsnew file mode 100644index 0000000000..46e274aa7e--- /dev/null+++ b/apps/web/src/features/calendar/utils/conference-link.test.ts@@ -0,0 +1,54 @@+import { describe, expect, it } from 'vitest';+import { conferenceJoinUrl } from './conference-link';++describe('conferenceJoinUrl', () => {+ it('selects the calendar account for a bare Google Meet URL', () => {+ expect(+ conferenceJoinUrl(+ 'https://meet.google.com/abc-defg-hij',+ )+ ).toBe('https://meet.google.com/abc-defg-hij?authuser=work%40macro.com');+ });++ it('replaces browser-specific account hints and preserves other parameters', () => {+ expect(+ conferenceJoinUrl(+ 'https://meet.google.com/abc-defg-hij?authuser=1&hs=122#join',+ )+ ).toBe(+ 'https://meet.google.com/abc-defg-hij?authuser=work%2Bcalendar%40macro.com&hs=122#join'+ );+ });++ it('replaces an email hint belonging to another account', () => {+ expect(+ conferenceJoinUrl(+ 'https://meet.google.com/abc-defg-hij?authuser=personal%40gmail.com',+ )+ ).toBe('https://meet.google.com/abc-defg-hij?authuser=work%40macro.com');+ });++ it.each([undefined, '', ' '])(+ 'keeps the link when no account is known (%s)',+ (email) => {+ const url = 'https://meet.google.com/abc-defg-hij?authuser=1&hs=122';+ expect(conferenceJoinUrl(url, email)).toBe(url);+ }+ );++ it.each([+ 'https://zoom.us/j/123?pwd=secret',+ 'https://teams.microsoft.com/l/meetup-join/123',+ 'https://macro.com/app/meeting/123',+ 'https://meet.google.com.example.org/abc-defg-hij',+ 'https://[email protected]/abc-defg-hij',+ 'http://meet.google.com/abc-defg-hij',+ 'javascript:alert(1)',+ 'invalid-url',+ ])('does not attach account information to other URLs (%s)', (url) => {+ expect(conferenceJoinUrl(url, '[email protected]')).toBe(url);+ });+});diff --git a/apps/web/src/features/calendar/utils/conference-link.ts b/apps/web/src/features/calendar/utils/conference-link.tsindex bbb54ea840..74e00e46d3 100644--- a/apps/web/src/features/calendar/utils/conference-link.ts+++ b/apps/web/src/features/calendar/utils/conference-link.ts@@ -10,3 +10,19 @@ export function safeConferenceUrl(value: string | undefined) {return undefined;}}++/** Select the connected account only when joining; keep stored/copied links neutral. */+export function conferenceJoinUrl(value: string, accountEmail?: string) {+ if (!accountEmail?.trim()) return value;+ try {+ const url = new URL(value);+ if (url.protocol !== 'https:' || url.hostname !== 'meet.google.com') {+ return value;+ }+ // Numeric authuser values depend on the browser's Google account order.+ url.searchParams.set('authuser', accountEmail.trim());+ return url.toString();+ } catch {+ return value;+ }+}diff --git a/apps/web/src/features/meetings/queries/upcoming-calendar-events.test.ts b/apps/web/src/features/meetings/queries/upcoming-calendar-events.test.tsindex 4ada87ae26..c2da39580d 100644--- a/apps/web/src/features/meetings/queries/upcoming-calendar-events.test.ts+++ b/apps/web/src/features/meetings/queries/upcoming-calendar-events.test.ts@@ -25,7 +25,12 @@ vi.mock('@queries/client', () => ({}));const today = new Date(2026, 8, 23, 12);-const source: CalendarSource = { id: 'primary', name: 'Work', color: 'blue' };+const source: CalendarSource = {+ id: 'primary',+ name: 'Work',+ color: 'blue',+ emailAddress: '[email protected]',+};const sources = new Map([[source.id, source]]);const list = vi.mocked(storageServiceClient.listCalendarOccurrences);const disposers: (() => void)[] = [];@@ -173,6 +178,9 @@ describe('upcoming calendar events source', () => {[1, 2, 3, 4, 5].map((day) => `event-${day}`));expect(result.events()[0].color).toBe(source.color);+ expect(result.events()[0].url).toBe(+ 'https://meet.google.com/room?authuser=calendar%40macro.com'+ );expect(list).toHaveBeenCalledTimes(1);expect(result.loading()).toBe(false);expect(result.findEvent(result.events()[0].id)).toEqual(@@ -180,6 +188,7 @@ describe('upcoming calendar events source', () => {title: 'event-1',attendees: [],isReadOnly: false,+ conferenceUrl: 'https://meet.google.com/room',}));});diff --git a/apps/web/src/features/meetings/queries/upcoming-calendar-events.ts b/apps/web/src/features/meetings/queries/upcoming-calendar-events.tsindex 4dbdcb3763..43b0749fa8 100644--- a/apps/web/src/features/meetings/queries/upcoming-calendar-events.ts+++ b/apps/web/src/features/meetings/queries/upcoming-calendar-events.ts@@ -10,7 +10,10 @@ import {isCalendarEventVisible,mapCalendarOccurrence,} from '../../calendar/types';-import { safeConferenceUrl } from '../../calendar/utils/conference-link';+import {+ conferenceJoinUrl,+ safeConferenceUrl,+} from '../../calendar/utils/conference-link';import { calendarMacroCallUrl } from '../../calendar/utils/macro-call-link';import {isMeetingEvent,@@ -94,7 +97,9 @@ export function useUpcomingCalendarEventsSource(options: SourceOptions) {id: event.id,title: event.title,color: event.calendar.color,- url,+ url: url+ ? conferenceJoinUrl(url, event.calendar.emailAddress)+ : undefined,start: event.start,end: event.end,allDay: event.allDay,diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.mdindex d914837f0a..ea9ab55505 100644--- a/docs/agent-guide/calendar.md+++ b/docs/agent-guide/calendar.md@@ -11,6 +11,14 @@ the connected calendar mailbox. Outlook out-of-office automatic replies show anuncertainty notice if a provider response cannot be confirmed; a reconnect mustnot resend an already attempted automatic reply.+Google Meet joins from event details, the upcoming-events sidebar, and calendar+search use the displayed occurrence's connected calendar email as `authuser` when+that account is known. Existing parameters such as `hs` are preserved. Copied call+links keep their original URL so they can be shared with other attendees. Verify+desktop and mobile Join with work and personal Google accounts signed in; a work+calendar should open Meet with the work account. Search results without loaded+calendar account metadata and other conferencing providers keep their original URL.+Event composer dropdown triggers and date/time inputs use the theme controlsurface, so they blend with the dialog instead of using the darker page fill.Their menus stay inside the composer's portal scope. Verify that calendar,