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(notifications): show bot sender names in Home reply notifications (#7295)
gbirman3870a3649dc8
diff --git a/apps/web/src/features/home/components/HomeListEntity.tsx b/apps/web/src/features/home/components/HomeListEntity.tsxindex 475a908ade..6b3738f47e 100644--- a/apps/web/src/features/home/components/HomeListEntity.tsx+++ b/apps/web/src/features/home/components/HomeListEntity.tsx@@ -147,17 +147,24 @@ function HomeThreadTitle(const entity = props.entity;if (entity.type !== 'channel_thread') return undefined;const notification = entity.notifications?.()?.[0];- if (- notification?.notification_metadata?.tag === 'channel_message_reply' &&- notification.sender_id- ) {- return { id: notification.sender_id };+ if (notification?.notification_metadata?.tag === 'channel_message_reply') {+ return {+ id: notification.sender_id,+ displayName:+ notification.notification_metadata.content.senderDisplayName,+ details: undefined,+ };}- return { id: entity.senderId, details: entity.sender };+ return {+ id: entity.senderId,+ displayName: undefined,+ details: entity.sender,+ };};const senderLabel = () => {const value = sender();if (!value) return 'Someone';+ if (!value.id) return value.displayName?.trim() || 'Someone';if (value.id === currentUserId()) return 'You';return (getBotDisplayName(value.id, value.details) ||diff --git a/apps/web/src/features/home/components/home-press.test.tsx b/apps/web/src/features/home/components/home-press.test.tsxindex dda1a32921..022d44ac62 100644--- a/apps/web/src/features/home/components/home-press.test.tsx+++ b/apps/web/src/features/home/components/home-press.test.tsx@@ -1,5 +1,7 @@+import type { ChannelThreadEntity, WithNotification } from '@entity';+import type { UnifiedNotification } from '@notifications/types';import { cleanup, fireEvent, render } from '@solidjs/testing-library';-import type { JSX } from 'solid-js';+import { createSignal, type JSX } from 'solid-js';import { afterEach, describe, expect, it, vi } from 'vitest';import { HomeListEntity } from './HomeListEntity';@@ -8,7 +10,8 @@ vi.mock('@app/features/agents-view/views/AgentSessionListItem', () => ({}));vi.mock('@core/context/user', () => ({ useUserId: () => () => 'test-user' }));vi.mock('@core/user', () => ({- getDisplayName: () => 'Peter',+ getDisplayName: (id: string) =>+ id === 'macro|[email protected]' ? 'Teo' : 'Peter',tryMacroId: (id: string) => id,}));vi.mock('@components/app/split-panel', () => ({@@ -31,6 +34,91 @@ vi.mock('@ui', async () => ({afterEach(cleanup);+describe('Home channel reply row', () => {+ const replyNotification = (+ senderId: string | null,+ senderDisplayName: string | null = null+ ): UnifiedNotification => ({+ id: 'reply-notification',+ entity_id: 'bug-reports',+ entity_type: 'channel',+ sender_id: senderId,+ state: 'seen',+ created_at: '2026-10-01T16:34:48Z',+ updated_at: '2026-10-01T16:34:48Z',+ sent: true,+ viewed_at: null,+ notification_event_type: 'channel_message_reply',+ notification_metadata: {+ tag: 'channel_message_reply',+ content: {+ messageId: 'reply',+ messageContent: 'Reply to Peter',+ threadId: 'root',+ channelType: 'private',+ senderDisplayName,+ threadParentSenderId: 'macro|[email protected]',+ },+ },+ });++ const renderThread = (initial: UnifiedNotification[] = []) => {+ const [notifications, setNotifications] = createSignal(initial);+ const entity: WithNotification<ChannelThreadEntity> = {+ type: 'channel_thread',+ id: 'root',+ name: 'bug-reports',+ ownerId: 'macro|[email protected]',+ channelId: 'bug-reports',+ channelType: 'private',+ messageId: 'root',+ threadId: 'root',+ senderId: 'macro|[email protected]',+ sender: { id: 'macro|[email protected]', type: 'user' },+ content: 'calendar invite has raw html',+ attachments: [],+ reactions: [],+ thread: { replyCount: 2, preview: [] },+ notifications,+ };+ const view = render(() => (+ <HomeListEntity entity={entity} occurrenceKey="root" />+ ));+ const row = view.container.querySelector<HTMLElement>('[data-home-item]')!;+ return { row, setNotifications };+ };++ it('updates the sender from a human reply to a bot reply', () => {+ const { row, setNotifications } = renderThread([+ replyNotification('macro|[email protected]'),+ ]);+ expect(row.textContent).toContain('Teo in #bug-reports');++ setNotifications([+ replyNotification(null, 'Codex'),+ replyNotification('macro|[email protected]'),+ ]);+ expect(row.textContent).toContain('Codex in #bug-reports');+ expect(row.textContent).not.toContain('Peter');+ });++ it('uses the thread author when there is no notification', () => {+ expect(renderThread().row.textContent).toContain('Peter in #bug-reports');+ });++ it('does not attribute an unnamed bot reply to the thread author', () => {+ expect(renderThread([replyNotification(null)]).row.textContent).toContain(+ 'Someone in #bug-reports'+ );+ });++ it('keeps the current user label for human replies', () => {+ expect(+ renderThread([replyNotification('test-user')]).row.textContent+ ).toContain('You in #bug-reports');+ });+});+describe('Home recent press', () => {function setup() {const activate = vi.fn();