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
feat(channel): assign @mentioned users when creating task from message (#2962)
gbirman6f68dd04d4e6
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsxindex f07a523a8e..d1374fbee2 100644--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx@@ -270,7 +270,7 @@ registerComponent('task-compose', (params) => {<ComposeTaskinitialContent={params?.initialContent}initialTitle={params?.initialTitle}- initialAssigneeId={params?.initialAssigneeId}+ initialAssigneeIds={params?.initialAssigneeIds}onSuccess={params?.onSuccess}/>);diff --git a/js/app/packages/block-md/component/ComposeTask.tsx b/js/app/packages/block-md/component/ComposeTask.tsxindex 8c23a92fd7..98a704e5b3 100644--- a/js/app/packages/block-md/component/ComposeTask.tsx+++ b/js/app/packages/block-md/component/ComposeTask.tsx@@ -165,7 +165,7 @@ export interface ComposeTaskProps {initialTitle?: string;initialContent?: string;placeholder?: string;- initialAssigneeId?: string;+ initialAssigneeIds?: string[];/*** When provided, replaces the default success behavior (auto-copy link +* toast) so the caller can handle the created task however it needs.@@ -179,11 +179,20 @@ export function ComposeTask(props: ComposeTaskProps) {const currentUserId = useUserId();const getDefaultPropertyValues = (): Record<string, PropertyApiValues> => {- const id = props.initialAssigneeId ?? currentUserId();+ const ids = (() => {+ if (props.initialAssigneeIds && props.initialAssigneeIds.length > 0) {+ return [...new Set(props.initialAssigneeIds)];+ }+ const id = currentUserId();+ return id ? [id] : [];+ })();return {[SYSTEM_PROPERTY_IDS.ASSIGNEES]: {valueType: 'ENTITY' as const,- refs: id ? [{ entity_id: id, entity_type: 'USER' as const }] : [],+ refs: ids.map((entity_id) => ({+ entity_id,+ entity_type: 'USER' as const,+ })),},[SYSTEM_PROPERTY_IDS.STATUS]: {valueType: 'SELECT_STRING' as const,@@ -197,7 +206,7 @@ export function ComposeTask(props: ComposeTaskProps) {if (!props.initialTitle &&!props.initialContent &&- !props.initialAssigneeId+ !props.initialAssigneeIds?.length) {const draft = loadTaskComposerDraft();if (draft) {diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsxindex a251bbfb32..c69e0beec9 100644--- a/js/app/packages/channel/Channel/Channel.tsx+++ b/js/app/packages/channel/Channel/Channel.tsx@@ -49,6 +49,7 @@ import { useSplitLayout } from '@app/component/split-layout/layout';import { openChatWithInput } from '@app/component/ChatWithAgentButton';import { useChannelName, useChannelActivity } from '@core/context/channels';import { buildMentionMarkdownString, markdownToPlainText } from '@lexical-core';+import { extractUserMentions } from '@core/util/taskExtraction';import { createActivityTracker } from '@channel/activity-tracker';import {invalidateChannelsActivity,@@ -247,12 +248,15 @@ export function Channel(props: ChannelProps) {const plainText = markdownToPlainText(ctx.message.content).trim();const title =plainText.length > 70 ? `${plainText.slice(0, 70)}...` : plainText;+ const mentionedUserIds = extractUserMentions(ctx.message.content);popoverSplit({type: 'component',id: 'task-compose',params: {initialTitle: title,initialContent: buildChannelMessageMention(ctx.message),+ initialAssigneeIds:+ mentionedUserIds.length > 0 ? mentionedUserIds : undefined,},});},diff --git a/js/app/packages/core/component/UserTooltip.tsx b/js/app/packages/core/component/UserTooltip.tsxindex 502d0a8b99..c0dc740325 100644--- a/js/app/packages/core/component/UserTooltip.tsx+++ b/js/app/packages/core/component/UserTooltip.tsx@@ -71,7 +71,7 @@ export function UserTooltip(props: UserTooltipProps) {popoverSplit({type: 'component',id: 'task-compose',- params: { initialAssigneeId: props.id },+ params: { initialAssigneeIds: [props.id] },});}};