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(messages): offer people in every document composer's mention menu (#6787)
gbirman6606004b50a5
diff --git a/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx b/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsxindex a63fbd1d13..b6c4da5729 100644--- a/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx+++ b/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx@@ -24,7 +24,6 @@ import type { UserMentionRecord } from '@core/component/LexicalMarkdown/utils/meimport { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';import CaretLeftIcon from '@phosphor/caret-left.svg';import CaretRightIcon from '@phosphor/caret-right.svg';-import { useContacts } from '@queries/contacts/contacts';import { usePostTypingUpdateMutation } from '@queries/messages/typing';import { Button, cn } from '@ui';import { $setSelection } from 'lexical';@@ -107,8 +106,6 @@ function MessagePinnedReplyComposer(props: {}) {const context = useContext(CommentsContext);const typing = usePostTypingUpdateMutation();- // Workspace users for @-mentions, matching the legacy comment composer.- const participants = useContacts();const parent = () => ({ type: 'document' as const, id: context.documentId });return (<StaticMarkdownContext theme={drawerCommentTheme}>@@ -118,7 +115,6 @@ function MessagePinnedReplyComposer(props: {><ChannelInputparent={parent()}- participants={participants}input={{ mode: 'reply', placeholder: 'Reply...' }}autofocus={false}onStartTyping={() =>diff --git a/apps/web/src/features/channel/Channel/Channel.tsx b/apps/web/src/features/channel/Channel/Channel.tsxindex 28f87cd42d..8a4c3c7c73 100644--- a/apps/web/src/features/channel/Channel/Channel.tsx+++ b/apps/web/src/features/channel/Channel/Channel.tsx@@ -808,7 +808,6 @@ export function Channel(props: ChannelProps) {}listMeta={listMetaByMessageId()[item.id]}messageEditor={messageEditor}- participants={participants.users}threadActions={{onDismissNewMessages:activityTracker.dismissNewMessages,diff --git a/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx b/apps/web/src/features/channel/Channel/InlineMessageEditor.tsxindex 2a0f31aee5..3e143c1ff3 100644--- a/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx+++ b/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx@@ -1,9 +1,7 @@import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';import { TOKENS } from '@core/hotkey/tokens';-import type { IUser } from '@core/user/types';import type { MessageParent } from '@service-storage/messages';import { cn } from '@ui';-import type { Accessor } from 'solid-js';import {ChannelInput,createInputAttachmentTracker,@@ -18,7 +16,6 @@ type MessageEditorContentProps = {parent: MessageParent;message: MessageData;messageEditor: MessageEditor;- participants?: Accessor<IUser[]>;class?: string;collapsible?: boolean;/** Defaults to `!isMobile()` inside `ChannelInput`. */@@ -66,7 +63,6 @@ export function MessageEditorContent(props: MessageEditorContentProps) {collapsible={props.collapsible}autofocus={props.autofocus}attachmentTracker={attachmentTracker}- participants={props.participants}bots={channelBotMentionUsers}markdownNamespace={`edit-message-${props.parent.type}:${props.parent.id}-${props.message.id}`}onReady={props.onReady}diff --git a/apps/web/src/features/channel/Channel/UnifiedEditInput.tsx b/apps/web/src/features/channel/Channel/UnifiedEditInput.tsxindex f3b91e7b6d..b3f7542b07 100644--- a/apps/web/src/features/channel/Channel/UnifiedEditInput.tsx+++ b/apps/web/src/features/channel/Channel/UnifiedEditInput.tsx@@ -1,7 +1,6 @@import { Show } from 'solid-js';import { InputFlag } from '../Input';import type { MessageData } from '../Message';-import { useChannelParticipants } from '../use-channel-participants';import type { MessageEditor } from './create-message-editor';import { MessageEditorContent } from './InlineMessageEditor';@@ -14,8 +13,6 @@ export function UnifiedEditInput(props: {messageEditor: MessageEditor;onNavigateToMessage: (message: MessageData) => void;}) {- const participants = useChannelParticipants(() => props.channelId);-return (<Show when={props.messageEditor.state()?.message} keyed>{(message) => (@@ -30,7 +27,6 @@ export function UnifiedEditInput(props: {parent={{ type: 'channel', id: props.channelId }}message={message}messageEditor={props.messageEditor}- participants={participants.users}collapsibleautofocus={false}onReady={(handle) => {diff --git a/apps/web/src/features/channel/Input/ChannelInput.tsx b/apps/web/src/features/channel/Input/ChannelInput.tsxindex c53550cb62..07c5ddf63d 100644--- a/apps/web/src/features/channel/Input/ChannelInput.tsx+++ b/apps/web/src/features/channel/Input/ChannelInput.tsx@@ -37,6 +37,7 @@ import {import { Dynamic } from 'solid-js/web';import { useAgentMentionUsers } from '../use-agent-mention-users';import { useMessageBotMentionUsers } from '../use-channel-bot-mention-users';+import { useMessageParticipants } from '../use-message-participants';import { CHANNEL_FILE_PICKER_ACCEPT } from './accepted-file-types';import { createConfiguredChannelMarkdownEditor } from './configured-markdown-editor';import { createCollapsedInputState } from './create-collapsed-input-state';@@ -66,6 +67,11 @@ export type ChannelInputProps = InputCallbacks & {markdownNamespace?: string;persistenceKey?: InputPersistenceKey;attachmentTracker?: InputAttachmentTracker;+ /**+ * People surfaced in the `@`-mention typeahead. Defaults to the `parent`'s+ * own people: a channel's participants, or the workspace contacts a+ * document's composers offer.+ */participants?: Accessor<IUser[]>;/** Channel bots surfaced in the `@`-mention typeahead alongside users. */bots?: Accessor<IUser[]>;@@ -229,10 +235,14 @@ export function ChannelInput(props: ChannelInputProps) {!props.bots && props.parent? useMessageBotMentionUsers(() => props.parent!): () => [];+ const parentParticipants =+ !props.participants && props.parent+ ? useMessageParticipants(() => props.parent!)+ : () => [];// Connection-prompt behavior for the built-in agents lives in// useAgentMentionUsers; participants and channel/document bots feed it here.const mentionUsers = useAgentMentionUsers(() => [- ...(props.participants?.() ?? []),+ ...(props.participants?.() ?? parentParticipants()),...(props.bots?.() ?? parentBots()),]);diff --git a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx b/apps/web/src/features/channel/Input/tests/input-slots.test.tsxindex 30dff3411e..220921f63e 100644--- a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx+++ b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx@@ -243,7 +243,43 @@ vi.mock('../FormatButtons', () => ({FormatButtons: () => <div data-testid="format-buttons" />,}));+const peopleMocks = vi.hoisted(() => ({+ contactsEnabled: undefined as boolean | undefined,+}));+const CONTACT = {+ id: 'macro|[email protected]',+ name: 'Ann',+ email: '[email protected]',+};+const CHANNEL_MEMBER = { user_id: 'macro|[email protected]' };++vi.mock('@queries/contacts/contacts', () => ({+ useContacts: (enabled?: () => boolean) => {+ peopleMocks.contactsEnabled = enabled?.() ?? true;+ return () => [CONTACT];+ },+}));+vi.mock('@queries/channel/channel-participants', () => ({+ useChannelParticipantsQuery: (channelId: () => string) => ({+ isLoading: false,+ get data() {+ return channelId() ? [CHANNEL_MEMBER] : [];+ },+ }),+}));+vi.mock('@core/context/user', async (importOriginal) => ({+ ...(await importOriginal<typeof import('@core/context/user')>()),+ useUserId: () => () => 'macro|[email protected]',+}));+vi.mock('@queries/messages/mutations', () => ({+ useSendMessageMutation: () => ({ mutate: vi.fn() }),+}));+vi.mock('@queries/messages/typing', () => ({+ usePostTypingUpdateMutation: () => ({ mutate: vi.fn() }),+}));+import { cursorMentionUser } from '../../macroAi';+import { ThreadReplyChannelInput } from '../../Thread/ThreadReplyChannelInput';import { createInputAttachmentTracker } from '../attachment-tracker';import { ChannelInput } from '../ChannelInput';import { DropOverlay } from '../DropOverlay';@@ -500,3 +536,61 @@ describe('Input slots', () => {expect(screen.getByText('Drop files to attach')).toBeTruthy();});});++/**+ * Mention people reach the shared input from its `parent`, so every composer+ * on a document — root, reply, and edit — offers the same people. The+ * document composers regressed once by relying on each call site to pass+ * them: a document reply offered agents and bots but no People at all.+ */+describe('mention people', () => {+ const documentParent = { type: 'document', id: 'doc-1' } as const;+ const channelParent = { type: 'channel', id: 'channel-1' } as const;+ const mentionIds = () => editorMocks.mentionUsers?.().map((user) => user.id);++ beforeEach(() => {+ editorMocks.mentionUsers = undefined;+ peopleMocks.contactsEnabled = undefined;+ });++ it('offers a document composer the workspace contacts', () => {+ render(() => <ChannelInput input={baseInput} parent={documentParent} />);++ expect(mentionIds()).toContain(CONTACT.id);+ });++ it('offers a channel composer its participants, not the workspace contacts', () => {+ render(() => <ChannelInput input={baseInput} parent={channelParent} />);++ expect(mentionIds()).toContain(CHANNEL_MEMBER.user_id);+ expect(mentionIds()).not.toContain(CONTACT.id);+ // A channel never shows them, so it should not fetch them either.+ expect(peopleMocks.contactsEnabled).toBe(false);+ });++ it('keeps an explicitly supplied participants list', () => {+ render(() => (+ <ChannelInput+ input={baseInput}+ parent={documentParent}+ participants={() => []}+ />+ ));++ expect(mentionIds()).not.toContain(CONTACT.id);+ });++ it('offers people in a document thread reply composer', () => {+ render(() => (+ <ThreadReplyChannelInput+ parent={documentParent}+ threadId="root-1"+ replyInputState={() => undefined}+ setReplyInputState={() => undefined}+ onExit={() => {}}+ />+ ));++ expect(mentionIds()).toContain(CONTACT.id);+ });+});diff --git a/apps/web/src/features/channel/Message/ChannelMessage.tsx b/apps/web/src/features/channel/Message/ChannelMessage.tsxindex da2c991d98..c43ac00393 100644--- a/apps/web/src/features/channel/Message/ChannelMessage.tsx+++ b/apps/web/src/features/channel/Message/ChannelMessage.tsx@@ -1,11 +1,10 @@import { useMessageActionDrawer } from '@channel/Mobile/message-action-drawer-context';import { touchHandler } from '@core/directive/touchHandler';import type { MessageActions, MessageData } from '@core/messages/types';-import type { IUser } from '@core/user/types';import { messageSendMotion } from '@core/util/message-send-motion';import TrashIcon from '@phosphor/trash.svg';import type { MessageParent } from '@service-storage/messages';-import { type Accessor, type JSX, Match, Show, Switch } from 'solid-js';+import { type JSX, Match, Show, Switch } from 'solid-js';import type { MessageEditor } from '../Channel/create-message-editor';import { MessageEditorContent } from '../Channel/InlineMessageEditor';import { useMessage } from './context';@@ -20,7 +19,6 @@ type ChannelMessageProps = {actions?: MessageActions;listMeta?: ChannelMessageListMeta;messageEditor?: MessageEditor;- participants?: Accessor<IUser[]>;selected?: boolean;/*** The unified-input mode's floating reply/edit input, or message@@ -41,7 +39,6 @@ function MessageContentSlot(props: {parent: MessageParent;inputMode?: 'inline' | 'unified';messageEditor?: MessageEditor;- participants?: Accessor<IUser[]>;class?: string;}) {const message = useMessage();@@ -59,7 +56,6 @@ function MessageContentSlot(props: {parent={props.parent}message={message()}messageEditor={messageEditor()}- participants={props.participants}class={props.class}/>)}@@ -117,7 +113,6 @@ function RegularMessageLayout(props: {parent: MessageParent;inputMode?: 'inline' | 'unified';messageEditor?: MessageEditor;- participants?: Accessor<IUser[]>;}) {return (<Message.Layout class="pt-(--regular-message-padding-t)">@@ -138,7 +133,6 @@ function RegularMessageLayout(props: {parent={props.parent}inputMode={props.inputMode}messageEditor={props.messageEditor}- participants={props.participants}/></Message.Slot><Message.Slot@@ -156,7 +150,6 @@ function GroupedMessageLayout(props: {parent: MessageParent;inputMode?: 'inline' | 'unified';messageEditor?: MessageEditor;- participants?: Accessor<IUser[]>;}) {return (<Message.Layout>@@ -169,7 +162,6 @@ function GroupedMessageLayout(props: {parent={props.parent}inputMode={props.inputMode}messageEditor={props.messageEditor}- participants={props.participants}class="min-w-0 flex-1"/></div>@@ -223,7 +215,6 @@ export function ChannelMessage(props: ChannelMessageProps) {parent={props.parent}inputMode={props.inputMode}messageEditor={props.messageEditor}- participants={props.participants}/></Match><Match when={true}>@@ -231,7 +222,6 @@ export function ChannelMessage(props: ChannelMessageProps) {parent={props.parent}inputMode={props.inputMode}messageEditor={props.messageEditor}- participants={props.participants}/></Match></Switch>diff --git a/apps/web/src/features/channel/Thread/ChannelThread.tsx b/apps/web/src/features/channel/Thread/ChannelThread.tsxindex 13a0c1a1ae..3210142964 100644--- a/apps/web/src/features/channel/Thread/ChannelThread.tsx+++ b/apps/web/src/features/channel/Thread/ChannelThread.tsx@@ -315,7 +315,6 @@ export function ChannelThread(props: ThreadProps) {listMeta={props.listMeta}inputMode={props.inputMode}messageEditor={props.messageEditor}- participants={props.participants}onClick={selectThreadMessage}selected={isSelected() && !isThreadFocused()}targeted={@@ -353,7 +352,6 @@ export function ChannelThread(props: ThreadProps) {getMessageActions={props.getMessageActions}inputMode={props.inputMode}messageEditor={props.messageEditor}- participants={props.participants}isNewMessage={props.isNewMessage}onReady={setReplyListHandle}positionTarget={props.targetNavigation?.positionTarget}diff --git a/apps/web/src/features/channel/Thread/ThreadReplyChannelInput.tsx b/apps/web/src/features/channel/Thread/ThreadReplyChannelInput.tsxindex db1bafc775..a0aef080e0 100644--- a/apps/web/src/features/channel/Thread/ThreadReplyChannelInput.tsx+++ b/apps/web/src/features/channel/Thread/ThreadReplyChannelInput.tsx@@ -18,7 +18,6 @@ import {} from '../Input/utils/persistence';import { hasSendableInputContent } from '../Input/utils/sendable-content';import { useMessageBotMentionUsers } from '../use-channel-bot-mention-users';-import { useChannelParticipants } from '../use-channel-participants';import type { FocusRequest } from './focus-request';type ThreadReplyChannelInputProps = {@@ -56,9 +55,6 @@ export function ThreadReplyChannelInput(props: ThreadReplyChannelInputProps) {const userId = useUserId();const sendMessageMutation = useSendMessageMutation();const typingMutation = usePostTypingUpdateMutation();- const participants = useChannelParticipants(() =>- props.parent.type === 'channel' ? props.parent.id : ''- );const channelBotMentionUsers = useMessageBotMentionUsers(() => props.parent);const tracker = createInputAttachmentTracker({@@ -110,7 +106,6 @@ export function ThreadReplyChannelInput(props: ThreadReplyChannelInputProps) {}}collapsible={props.collapsible}autofocus={false}- participants={participants.users}bots={channelBotMentionUsers}attachmentTracker={tracker}persistenceKey={makeInputValuePersistenceKey({diff --git a/apps/web/src/features/channel/Thread/ThreadReplyList.tsx b/apps/web/src/features/channel/Thread/ThreadReplyList.tsxindex 5ba3bb97a5..59d053902e 100644--- a/apps/web/src/features/channel/Thread/ThreadReplyList.tsx+++ b/apps/web/src/features/channel/Thread/ThreadReplyList.tsx@@ -1,4 +1,3 @@-import type { IUser } from '@core/user/types';import { MarkMessageNotifications } from '@notifications/components/MarkMessageNotifications';import type {Message as EntityMessage,@@ -28,7 +27,6 @@ export function ThreadReplyList(props: {replies: Array<EntityMessage>;getMessageActions?: (message: MessageData) => MessageActions | undefined;messageEditor?: MessageEditor;- participants?: Accessor<IUser[]>;isNewMessage?: (message: NewMessageCheckable) => boolean;onReady?: (handle: ThreadReplyListHandle) => void;positionTarget?: (@@ -94,7 +92,6 @@ export function ThreadReplyList(props: {actions={props.getMessageActions?.(replyMessage())}listMeta={listMetaByReplyId()[id]}messageEditor={props.messageEditor}- participants={props.participants}onClick={() => props.onSelectReply?.(id)}selected={isReplySelected()}targeted={props.targetedReplyId?.() === id}diff --git a/apps/web/src/features/channel/Thread/types.ts b/apps/web/src/features/channel/Thread/types.tsindex ba1378ef39..2aade377c1 100644--- a/apps/web/src/features/channel/Thread/types.ts+++ b/apps/web/src/features/channel/Thread/types.ts@@ -1,7 +1,6 @@import type { MessageEditor } from '@channel/Channel/create-message-editor';import type { NewMessageCheckable } from '@channel/Channel/util';import type { InputHandle, InputSnapshot } from '@channel/Input';-import type { IUser } from '@core/user/types';import type { MessageListItem, MessageParent } from '@service-storage/messages';import type { Accessor, Setter } from 'solid-js';import type {@@ -60,7 +59,6 @@ export type ThreadProps = {listMeta?: ChannelMessageListMeta;threadActions?: ThreadActions;messageEditor?: MessageEditor;- participants?: Accessor<IUser[]>;targetNavigation?: ThreadTargetNavigation;/** Whether the channel's Cmd+F find bar is currently open. */isFindBarOpen: Accessor<boolean>;diff --git a/apps/web/src/features/channel/use-message-participants.ts b/apps/web/src/features/channel/use-message-participants.tsnew file mode 100644index 0000000000..90828821fa--- /dev/null+++ b/apps/web/src/features/channel/use-message-participants.ts@@ -0,0 +1,26 @@+import type { IUser } from '@core/user/types';+import { useContacts } from '@queries/contacts/contacts';+import type { MessageParent } from '@service-storage/messages';+import { type Accessor, createMemo } from 'solid-js';+import { useChannelParticipants } from './use-channel-participants';++/**+ * The people a composer on `parent` offers in the `@`-mention typeahead: a+ * channel's participants, or, on a document, the workspace contacts the+ * legacy comment input suggested. Mirrors `useMessageBotMentionUsers` so that+ * every composer on a parent — root, reply, and edit — suggests the same+ * people without each one resolving them again.+ */+export function useMessageParticipants(+ parent: Accessor<MessageParent>+): Accessor<IUser[]> {+ const isChannel = () => parent().type === 'channel';+ const channelParticipants = useChannelParticipants(() =>+ isChannel() ? parent().id : ''+ );+ const contacts = useContacts(() => !isChannel());++ return createMemo(() =>+ isChannel() ? channelParticipants.users() : contacts()+ );+}diff --git a/apps/web/src/lib/core/comments/Thread.test.tsx b/apps/web/src/lib/core/comments/Thread.test.tsxindex fb26a48f72..6038fb940d 100644--- a/apps/web/src/lib/core/comments/Thread.test.tsx+++ b/apps/web/src/lib/core/comments/Thread.test.tsx@@ -37,7 +37,6 @@ vi.mock('@core/constant/featureFlags', async (importOriginal) => ({isFeatureEnabled: () => mocks.unifiedDiscussions,}));vi.mock('@channel/Input', () => ({ ChannelInput: () => null }));-vi.mock('@queries/contacts/contacts', () => ({ useContacts: () => () => [] }));vi.mock('@channel/Input/message-payload', () => ({buildPostMessageSendPayload: () => ({ message: {} }),}));diff --git a/apps/web/src/lib/core/comments/Thread.tsx b/apps/web/src/lib/core/comments/Thread.tsxindex 1fba6fc116..a09415ba69 100644--- a/apps/web/src/lib/core/comments/Thread.tsx+++ b/apps/web/src/lib/core/comments/Thread.tsx@@ -10,7 +10,6 @@ import {} from '@core/constant/featureFlags';import { MessageThreadById } from '@core/messages/MessageThread';import { buildSimpleEntityUrl } from '@core/util/url';-import { useContacts } from '@queries/contacts/contacts';import { Layer } from '@ui';import type { EditorThemeClasses } from 'lexical';import {@@ -163,8 +162,6 @@ export function ThreadBody(props: ThreadBodyProps) {/** Document threads render the shared message thread; a draft composes its root. */function MessageThreadBody(props: ThreadBodyProps) {const context = useContext(CommentsContext);- // Workspace users for @-mentions, matching the legacy comment composer.- const participants = useContacts();const parent = () => ({ type: 'document' as const, id: context.documentId });const targetId = () => {const highlighted = context.highlightedCommentId();@@ -177,7 +174,6 @@ function MessageThreadBody(props: ThreadBodyProps) {fallback={<ChannelInputparent={parent()}- participants={participants}flat={props.flatComposer}input={{ mode: 'reply', placeholder: 'Leave a comment...' }}onClose={() => context.setActiveThread(null)}diff --git a/apps/web/src/lib/core/messages/DocumentConversation.test.tsx b/apps/web/src/lib/core/messages/DocumentConversation.test.tsxindex 3664a5cb1b..60b4900d2e 100644--- a/apps/web/src/lib/core/messages/DocumentConversation.test.tsx+++ b/apps/web/src/lib/core/messages/DocumentConversation.test.tsx@@ -7,13 +7,12 @@ import { DocumentConversation } from './DocumentConversation';const mocks = vi.hoisted(() => ({timeline: vi.fn(),linkResolved: true,- contacts: [{ id: 'user|[email protected]', name: 'Ann', email: '[email protected]' }],- capturedParticipants: undefined as (() => Array<{ id: string }>) | undefined,+ capturedParent: undefined as { type: string; id: string } | undefined,}));vi.mock('@channel/Input', () => ({- ChannelInput: (props: { participants?: () => Array<{ id: string }> }) => {- mocks.capturedParticipants = props.participants;+ ChannelInput: (props: { parent?: { type: string; id: string } }) => {+ mocks.capturedParent = props.parent;return <textarea aria-label="Leave a comment..." />;},}));@@ -25,9 +24,6 @@ vi.mock('@channel/Thread/utils/message-actions', () => ({vi.mock('@channel/use-channel-bot-mention-users', () => ({useMessageBotMentionUsers: () => [],}));-vi.mock('@queries/contacts/contacts', () => ({- useContacts: () => () => mocks.contacts,-}));vi.mock('@core/component/LexicalMarkdown/component/core/StaticMarkdown',() => ({@@ -64,7 +60,7 @@ vi.mock('./MessageThread', () => ({afterEach(() => {mocks.linkResolved = true;- mocks.capturedParticipants = undefined;+ mocks.capturedParent = undefined;cleanup();});@@ -146,11 +142,9 @@ describe('DocumentConversation placement', () => {expect(view.getByRole('textbox')).toBeTruthy();});- it('offers workspace contacts as @-mention participants', () => {+ it('names the document as the composer parent so it resolves the same mentions as a reply', () => {discussion([[]], undefined, { canWrite: true });- // Without participants the composer would suggest only agents and bots,- // losing the user mentions the legacy comment input offered.- expect(mocks.capturedParticipants?.()).toEqual(mocks.contacts);+ expect(mocks.capturedParent).toEqual({ type: 'document', id: 'document' });});it('shows nothing from the shared latest page while a link is still resolving', () => {diff --git a/apps/web/src/lib/core/messages/DocumentConversation.tsx b/apps/web/src/lib/core/messages/DocumentConversation.tsxindex f9f1f7c070..286b9f34fe 100644--- a/apps/web/src/lib/core/messages/DocumentConversation.tsx+++ b/apps/web/src/lib/core/messages/DocumentConversation.tsx@@ -3,7 +3,6 @@ import { buildPostMessageSendPayload } from '@channel/Input/message-payload';import { useMessageBotMentionUsers } from '@channel/use-channel-bot-mention-users';import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import { useUserId } from '@core/context/user';-import { useContacts } from '@queries/contacts/contacts';import { useMessageLink } from '@queries/messages/document-messages';import { useSendMessageMutation } from '@queries/messages/mutations';import { useMessageTimelineQuery } from '@queries/messages/timeline';@@ -22,15 +21,11 @@ export function DocumentConversationComposer(props: {const send = useSendMessageMutation();const userId = useUserId();const bots = useMessageBotMentionUsers(() => props.parent);- // Workspace users for @-mentions, matching the legacy comment composer's- // global mention source; ChannelInput otherwise offers only agents and bots.- const participants = useContacts();let input: InputHandle | undefined;return (<ChannelInputparent={props.parent}bots={bots}- participants={participants}input={{ mode: 'channel', placeholder: 'Leave a comment...' }}autofocus={false}collapsible={props.collapsible}diff --git a/apps/web/src/lib/queries/contacts/contacts.ts b/apps/web/src/lib/queries/contacts/contacts.tsindex 8acc8cdf0a..6d9d7a467e 100644--- a/apps/web/src/lib/queries/contacts/contacts.ts+++ b/apps/web/src/lib/queries/contacts/contacts.ts@@ -15,16 +15,18 @@ function contactsQueryOptions() {}/** The raw contacts query — for callers that need its loading state. */-export function useContactsQuery() {- return useQuery(() => contactsQueryOptions());+export function useContactsQuery(enabled: Accessor<boolean> = () => true) {+ return useQuery(() => ({ ...contactsQueryOptions(), enabled: enabled() }));}/*** Returns contacts as IUser objects.* Compatible with the previous createResource-based implementation.*/-export function useContacts(): Accessor<IUser[]> {- const query = useContactsQuery();+export function useContacts(+ enabled: Accessor<boolean> = () => true+): Accessor<IUser[]> {+ const query = useContactsQuery(enabled);return createMemo(() => {if (!query.isSuccess) return [];const contacts = query.data.contacts;