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): say who asked to join in the join request notification row (#8637)
gbirmancd1b0d7f2ad6
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex b9ae13a0fa..1264bebd07 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -120,7 +120,7 @@ ownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.uncertain enqueues. See `docs/graphql-normalized-cache-plan.md`.- Mobile dock customization shares the navigation island’s measured capacity; persist ordering per user with `mobile-dock-order.ts`, preserve gated destinations, and keep Search and More fixed. Reorder handles drag without a hold delay; the rest of each row scrolls.- Share sidebar and mobile dock unread presence through `components/app/use-navigation-unread.ts`; keep badges reactive to read/done changes, guard all query data with `queryReadyGate` so pending preferences or paused queries cannot suspend the shell, and avoid fetching extra pages for counts.-- Name Home thread rows from their latest scoped notification, including document mentions and reactions; use the thread author only when no notification exists.+- Name Home thread rows from their latest scoped notification, including document mentions and reactions; use the thread author only when no notification exists. Document rows whose newest outstanding notification is a comment, and calendar event rows whose newest is a join request, say who did it (`row-notification.ts`).- Mobile dock search owns transient category/mode state in `features/command/mobile`; reuse the shared entity source and explicit full-text adapter rather than overlaying the dock query on view tabs or saved facets. See `docs/agent-guide/search.md` at the repository root.- Include known Macro users in typed All/People name searches without requiring a DM or CRM contact; resolve a matching person to their existing one-to-one DM while preserving name/email matching.- Key mobile name-result history ordering and scroll anchors by the other participant for one-to-one DMs, preserving a person's position when their conversation is created; keep group DMs keyed by channel.diff --git a/apps/web/src/features/home/components/HomeListEntity.tsx b/apps/web/src/features/home/components/HomeListEntity.tsxindex ba54806684..bd3b9e7ed7 100644--- a/apps/web/src/features/home/components/HomeListEntity.tsx+++ b/apps/web/src/features/home/components/HomeListEntity.tsx@@ -10,9 +10,11 @@ import { unreadFilterFn } from '@entity/utils/filter';import { entityIsMuted } from '@entity/utils/notification';import { getDocumentCommentNotification } from '@notifications/document-comment-notification';import { getNotificationAgentSender } from '@notifications/notification-sender';+import { getCalendarJoinRequestNotification } from '@notifications/row-notification';import type { UnifiedNotification } from '@notifications/types';import ArrowBendUpLeftIcon from '@phosphor-icons/core/regular/arrow-bend-up-left.svg?component-solid';import ChatTeardropIcon from '@phosphor-icons/core/regular/chat-teardrop.svg?component-solid';+import UserPlusIcon from '@phosphor-icons/core/regular/user-plus.svg?component-solid';import { getBotDisplayName } from '@queries/messages/message-sender';import { cn, pressHandlers } from '@ui';import { Match, Show, Switch } from 'solid-js';@@ -32,6 +34,9 @@ export function HomeListEntity(props: HomeListEntityProps) {// comment glyph, who did what, and where. Opening it lands on the comment.const commentNotification = () =>getDocumentCommentNotification(props.entity);+ // A calendar event someone asked to join says who asked, like a comment.+ const joinRequestNotification = () =>+ getCalendarJoinRequestNotification(props.entity);const unread = () => unreadFilterFn(props.entity);const notificationSource = useGlobalNotificationSource();const muted = () =>@@ -67,6 +72,11 @@ export function HomeListEntity(props: HomeListEntityProps) {<ChatTeardropIcon class="size-4" /></ViewSidebar.Icon></Match>+ <Match when={joinRequestNotification()}>+ <ViewSidebar.Icon>+ <UserPlusIcon class="size-4" />+ </ViewSidebar.Icon>+ </Match></Switch><spanclass={cn(@@ -92,9 +102,11 @@ export function HomeListEntity(props: HomeListEntityProps) {/>)}</Match>- <Match when={commentNotification()}>+ <Match+ when={commentNotification() ?? joinRequestNotification()}+ >{(notification) => (- <HomeCommentTitle+ <HomeNotificationTitleentity={props.entity}notification={notification()}/>@@ -194,7 +206,7 @@ function HomeThreadTitle();}-function HomeCommentTitle(props: {+function HomeNotificationTitle(props: {entity: HomeListEntityProps['entity'];notification: UnifiedNotification;}) {@@ -212,6 +224,7 @@ function HomeCommentTitle(props: {match(props.notification.notification_metadata.tag).with('mentioned_in_document_comment', () => ' mentioned you on ').with('replied_to_document_comment_thread', () => ' replied on ')+ .with('calendar_event_join_request', () => ' asked to join ').otherwise(() => ' commented on ');return (<span class="flex min-w-0 items-center">diff --git a/apps/web/src/features/home/components/home-press.test.tsx b/apps/web/src/features/home/components/home-press.test.tsxindex f810429428..70e24d6530 100644--- a/apps/web/src/features/home/components/home-press.test.tsx+++ b/apps/web/src/features/home/components/home-press.test.tsx@@ -348,3 +348,93 @@ describe('Home document comment row', () => {expect(row.textContent).not.toContain('Someone');});});++describe('Home calendar join request row', () => {+ const joinRequest = (+ overrides: Partial<UnifiedNotification> = {}+ ): UnifiedNotification => ({+ id: 'join-request',+ entity_id: 'event-1',+ entity_type: 'calendar_event',+ sender_id: 'macro|[email protected]',+ state: 'unseen',+ created_at: '2026-10-23T17:21:50Z',+ updated_at: '2026-10-23T17:21:50Z',+ sent: true,+ viewed_at: null,+ notification_event_type: 'calendar_event_join_request',+ notification_metadata: {+ tag: 'calendar_event_join_request',+ content: { eventId: 'event-1', requestId: 'request-1', title: 'Sync' },+ },+ ...overrides,+ });+ const reminder: UnifiedNotification = {+ ...joinRequest(),+ id: 'reminder',+ sender_id: null,+ created_at: '2026-10-23T17:30:00Z',+ updated_at: '2026-10-23T17:30:00Z',+ notification_event_type: 'calendar_event_reminder',+ notification_metadata: {+ tag: 'calendar_event_reminder',+ content: {+ eventId: 'event-1',+ occurrenceKey: '2026-10-23T18:00:00Z',+ title: 'Sync',+ startsAt: '2026-10-23T18:00:00Z',+ endsAt: '2026-10-23T18:30:00Z',+ startDate: null,+ timeZone: null,+ minutesBefore: 30,+ },+ },+ } as UnifiedNotification;++ const renderEvent = (+ initial: UnifiedNotification[],+ notificationDisplayCutoff?: string+ ) => {+ const [notifications, setNotifications] = createSignal(initial);+ const view = render(() => (+ <HomeListEntity+ entity={+ {+ type: 'calendar_event',+ id: 'event-1',+ name: 'Sync',+ ownerId: 'test-user',+ status: 'confirmed',+ isReadOnly: false,+ notifications,+ notificationDisplayCutoff,+ } as never+ }+ occurrenceKey="event-1"+ />+ ));+ const row = view.container.querySelector<HTMLElement>('[data-home-item]')!;+ return { row, setNotifications };+ };++ it('says who asked to join', () => {+ const { row } = renderEvent([joinRequest()]);+ expect(row.textContent).toContain('Teo asked to join Recent chat');+ });++ it('keeps the plain title when the newest outstanding notification is not a request', () => {+ const { row, setNotifications } = renderEvent([reminder, joinRequest()]);+ expect(row.textContent).not.toContain('asked to join');++ setNotifications([joinRequest({ state: 'done' })]);+ expect(row.textContent).not.toContain('asked to join');++ setNotifications([joinRequest()]);+ expect(row.textContent).toContain('Teo asked to join Recent chat');+ });++ it('does not let newer own activity borrow an older request', () => {+ const { row } = renderEvent([joinRequest()], '2026-10-23T18:00:00Z');+ expect(row.textContent).not.toContain('asked to join');+ });+});diff --git a/apps/web/src/features/notifications/document-comment-notification.ts b/apps/web/src/features/notifications/document-comment-notification.tsindex b5f50c5a78..00bcd624cb 100644--- a/apps/web/src/features/notifications/document-comment-notification.ts+++ b/apps/web/src/features/notifications/document-comment-notification.ts@@ -1,5 +1,5 @@-import { compareDateDesc } from '@core/util/date';import type { WithNotification } from '@entity/types/notification';+import { newestRowNotification } from './row-notification';import type { UnifiedNotification } from './types';export const DOCUMENT_COMMENT_EVENT_TYPES = [@@ -22,21 +22,9 @@ export function getDocumentCommentNotification(}>): UnifiedNotification | undefined {if (entity.type !== 'document') return undefined;- const notification = (entity.notifications?.() ?? [])- .filter((n) => n.state !== 'done')- .sort((a, b) => compareDateDesc(a.created_at, b.created_at))[0];- if (- !notification ||- !isDocumentCommentTag(notification.notification_metadata.tag)- ) {- return undefined;- }- if (- entity.notificationDisplayCutoff != null &&- compareDateDesc(notification.created_at, entity.notificationDisplayCutoff) >- 0- ) {- return undefined;- }- return notification;+ const notification = newestRowNotification(entity);+ return notification &&+ isDocumentCommentTag(notification.notification_metadata.tag)+ ? notification+ : undefined;}diff --git a/apps/web/src/features/notifications/row-notification.ts b/apps/web/src/features/notifications/row-notification.tsnew file mode 100644index 0000000000..5464027481--- /dev/null+++ b/apps/web/src/features/notifications/row-notification.ts@@ -0,0 +1,37 @@+import { compareDateDesc } from '@core/util/date';+import type { WithNotification } from '@entity/types/notification';+import type { UnifiedNotification } from './types';++/**+ * The newest outstanding notification a row can announce. Home supplies a+ * cutoff so newer own activity cannot borrow an older notification's label or+ * click target. Reading a notification does not dismiss it.+ */+export function newestRowNotification(+ entity: WithNotification<{ type: string }>+): UnifiedNotification | undefined {+ const notification = (entity.notifications?.() ?? [])+ .filter((n) => n.state !== 'done')+ .sort((a, b) => compareDateDesc(a.created_at, b.created_at))[0];+ if (!notification) return undefined;+ if (+ entity.notificationDisplayCutoff != null &&+ compareDateDesc(notification.created_at, entity.notificationDisplayCutoff) >+ 0+ ) {+ return undefined;+ }+ return notification;+}++/** A calendar event row announcing a request to join it, which names the requester. */+export function getCalendarJoinRequestNotification(+ entity: WithNotification<{ type: string }>+): UnifiedNotification | undefined {+ if (entity.type !== 'calendar_event') return undefined;+ const notification = newestRowNotification(entity);+ return notification?.notification_metadata.tag ===+ 'calendar_event_join_request'+ ? notification+ : undefined;+}diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.mdindex 135144d6ee..5af2808141 100644--- a/docs/agent-guide/calendar.md+++ b/docs/agent-guide/calendar.md@@ -571,7 +571,8 @@ reads `The person who shared this event can't add guests to it.` The card then s`Requested`, and `Invited` once accepted, and stops offering `Add to calendar` until the requestis declined: the sharer's answer is an invitation to the meeting, and a snapshot added meanwhilewould take that invitation in and stay a snapshot. The sharer gets a `calendar_event_join_request`-notification (Settings → Notifications → Calendar → Requests to join) that opens the event,+notification (Settings → Notifications → Calendar → Requests to join), which Home lists as+`<requester> asked to join <event>` with a person-plus glyph, like a comment row. It opens the event,whose details list each request with `Add as guest` and `Decline` on desktop and in the phonedrawer. Adding writes the guest through the same invite path as `Add guests`, so Google orOutlook sends the invitation and the mention then opens the viewer's own copy; declining tells