Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(tasks): add explicit shared with team opt in toggle (#7135)

Seamusd8147060fcaa
diff --git a/apps/web/src/components/ui/components/EntityComposer.tsx b/apps/web/src/components/ui/components/EntityComposer.tsx
index 88cdabfabb..06b07d411b 100644
--- a/apps/web/src/components/ui/components/EntityComposer.tsx
+++ b/apps/web/src/components/ui/components/EntityComposer.tsx
@@ -81,21 +81,30 @@ function Footer(props: SlotProps) {
);
}
-function Submit(props: Omit<ButtonProps, 'variant'> & { hasContent: boolean }) {
- const [local, rest] = splitProps(props, ['class', 'children', 'hasContent']);
+function Submit(props: ButtonProps & { hasContent: boolean }) {
+ const [local, rest] = splitProps(props, [
+ 'class',
+ 'children',
+ 'hasContent',
+ 'variant',
+ ]);
return (
<Button
{...rest}
- variant={local.hasContent ? 'accent' : 'ghost'}
+ variant={local.variant ?? (local.hasContent ? 'accent' : 'ghost')}
depth={3}
class={cn(
- 'gap-3 rounded-lg border-0',
+ 'gap-3 rounded-lg',
+ local.variant !== 'outline' && 'border-0',
!isTouchDevice() && 'rounded-full h-[33.75px] px-[15px]',
local.class
)}
>
{local.children}
- <Hotkey shortcut="cmd+enter" theme="current" />
+ <Hotkey
+ shortcut="cmd+enter"
+ theme={local.variant === 'outline' ? 'subtle' : 'current'}
+ />
</Button>
);
}
diff --git a/apps/web/src/features/block-md/component/ComposeTask.tsx b/apps/web/src/features/block-md/component/ComposeTask.tsx
index 45348f66e6..51cb4a3a74 100644
--- a/apps/web/src/features/block-md/component/ComposeTask.tsx
+++ b/apps/web/src/features/block-md/component/ComposeTask.tsx
@@ -1,3 +1,4 @@
+import { makePersistedState } from '@app/lib/persistence';
import { useSplitLayout } from '@components/app/split-layout/layout';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { useMacroMentionLinkResolver } from '@components/app/split-layout/split-router/mention-links';
@@ -40,7 +41,7 @@ import type { PropertyApiValues } from '@property/types';
import { useUpsertToHistoryMutation } from '@queries/history/history';
import { onElementConnect } from '@solid-primitives/lifecycle';
import { debounce } from '@solid-primitives/scheduled';
-import { Button, EntityComposer, Scroll, ToggleSwitch } from '@ui';
+import { Button, EntityComposer, Scroll, ToggleSwitch, Tooltip } from '@ui';
import {
$getRoot,
$getSelection,
@@ -415,7 +416,28 @@ export function ComposeTask(props: ComposeTaskProps) {
initialState.isDraftLoaded
);
const [createMore, setCreateMore] = createSignal(false);
+ const [shareWithTeam, setShareWithTeam] = makePersistedState(
+ createSignal(true),
+ {
+ storages: {
+ restore: () => {
+ const stored = localStorage.getItem('task-composer-share-with-team');
+ return stored === 'true'
+ ? true
+ : stored === 'false'
+ ? false
+ : undefined;
+ },
+ write: (value) =>
+ localStorage.setItem('task-composer-share-with-team', String(value)),
+ },
+ }
+ );
const [errorMessage, setErrorMessage] = createSignal<string>('');
+ const sharingHint = () =>
+ shareWithTeam()
+ ? 'Visible to your whole team'
+ : 'Only you and people you share with';
const [isCreating, setIsCreating] = createSignal(false);
const [tagLayoutMode, setTagLayoutMode] =
createSignal<ComposerTagLayoutMode>('bottom');
@@ -586,6 +608,7 @@ export function ComposeTask(props: ComposeTaskProps) {
createDefinitions(),
(params) => upsertToHistoryMutation.mutate(params),
{
+ shareWithTeam: shareWithTeam(),
onMutate: () => {
splitPanel.handle.close();
props.onClose?.();
@@ -621,6 +644,7 @@ export function ComposeTask(props: ComposeTaskProps) {
createDefinitions(),
(params) => upsertToHistoryMutation.mutate(params),
{
+ shareWithTeam: shareWithTeam(),
onMutate: () => {
resetTitleAndBody();
setIsCreating(false);
@@ -669,6 +693,7 @@ export function ComposeTask(props: ComposeTaskProps) {
createDefinitions(),
(params) => upsertToHistoryMutation.mutate(params),
{
+ shareWithTeam: shareWithTeam(),
onMutate: () => {
splitPanel.handle.close();
props.onClose?.();
@@ -1008,6 +1033,7 @@ export function ComposeTask(props: ComposeTaskProps) {
label="Create More"
/>
<EntityComposer.Submit
+ variant="outline"
onClick={handleCreateTask}
disabled={title().trim().length === 0 || isCreating()}
hasContent={title().trim().length > 0}
@@ -1017,6 +1043,20 @@ export function ComposeTask(props: ComposeTaskProps) {
</div>
</EntityComposer.Footer>
+ <div class="-mx-4 flex shrink-0 items-center gap-3 border-t border-edge-muted px-6 pt-4">
+ <ToggleSwitch
+ class="shrink-0"
+ checked={shareWithTeam()}
+ onChange={setShareWithTeam}
+ disabled={isCreating()}
+ label="Shared with Team"
+ labelClass="text-xs text-ink-muted font-normal whitespace-nowrap"
+ />
+ <Tooltip label={sharingHint()} class="min-w-0" tabIndex={0}>
+ <p class="truncate text-xs text-ink-muted">{sharingHint()}</p>
+ </Tooltip>
+ </div>
+
<SimilarTasksSection
title={title}
content={content}
diff --git a/apps/web/src/features/block-md/component/TaskDuplicateList.tsx b/apps/web/src/features/block-md/component/TaskDuplicateList.tsx
index 27947883a0..67647feec4 100644
--- a/apps/web/src/features/block-md/component/TaskDuplicateList.tsx
+++ b/apps/web/src/features/block-md/component/TaskDuplicateList.tsx
@@ -75,7 +75,7 @@ function SimilarTasksInner(props: {
return (
<Show when={entities().length > 0}>
- <div class="shrink-0 flex flex-col gap-0.5">
+ <div class="-mx-4 shrink-0 flex flex-col gap-0.5 border-t border-edge-muted px-4 pt-3">
<button
type="button"
class="flex items-center gap-1.5 px-1.5 py-1 text-xs font-medium text-ink-muted hover:text-ink"
diff --git a/apps/web/src/features/block-md/util/taskComposerProperties.ts b/apps/web/src/features/block-md/util/taskComposerProperties.ts
index 3403015e6c..3ad19a33cb 100644
--- a/apps/web/src/features/block-md/util/taskComposerProperties.ts
+++ b/apps/web/src/features/block-md/util/taskComposerProperties.ts
@@ -65,7 +65,11 @@ export async function createTaskWithProperties(
PropertyDefinition | PropertyDefinitionDetailResponse
>,
upsertToHistory: (params: { itemId: string; itemType: 'document' }) => void,
- options?: { revalidateSoup?: boolean; onMutate?: () => void }
+ options?: {
+ revalidateSoup?: boolean;
+ shareWithTeam?: boolean;
+ onMutate?: () => void;
+ }
) {
options?.onMutate?.();
// Convert properties to API format (filter out null values)
@@ -83,6 +87,7 @@ export async function createTaskWithProperties(
const createdTask = await createTaskWithInitialSnapshot({
revalidateSoup: options?.revalidateSoup,
+ shareWithTeam: options?.shareWithTeam,
title: taskTitle,
content: taskContent,
propertyValues: propertyValues.length > 0 ? propertyValues : undefined,
diff --git a/apps/web/src/features/projects/queries/create-project-task.test.ts b/apps/web/src/features/projects/queries/create-project-task.test.ts
index 92b1f3cca7..93ba2d6c15 100644
--- a/apps/web/src/features/projects/queries/create-project-task.test.ts
+++ b/apps/web/src/features/projects/queries/create-project-task.test.ts
@@ -100,9 +100,17 @@ it.each(['saved', 'failed', 'assignment-failed'] as const)(
[],
new Map(),
vi.fn(),
- { onMutate }
+ { onMutate, shareWithTeam: false }
);
await vi.waitFor(() => expect(mock.create).toHaveBeenCalledOnce());
+ expect(mock.create).toHaveBeenCalledWith(
+ 'Created task',
+ '',
+ [],
+ new Map(),
+ expect.any(Function),
+ { revalidateSoup: false, shareWithTeam: false }
+ );
expect(onMutate).toHaveBeenCalledOnce();
expect(assignTasks).not.toHaveBeenCalled();
complete(
diff --git a/apps/web/src/features/projects/queries/create-project-task.ts b/apps/web/src/features/projects/queries/create-project-task.ts
index 215c6bb61e..73d631fbf2 100644
--- a/apps/web/src/features/projects/queries/create-project-task.ts
+++ b/apps/web/src/features/projects/queries/create-project-task.ts
@@ -71,7 +71,7 @@ export function createProjectTaskMutation(
properties,
definitions,
history,
- { revalidateSoup: false }
+ { revalidateSoup: false, shareWithTeam: draft[5]?.shareWithTeam }
);
if (!result) throw new Error('Task creation failed');
let assigned = false;
diff --git a/apps/web/src/lib/core/util/create.ts b/apps/web/src/lib/core/util/create.ts
index 31a6f52c9d..29d7f437d4 100644
--- a/apps/web/src/lib/core/util/create.ts
+++ b/apps/web/src/lib/core/util/create.ts
@@ -82,6 +82,7 @@ export async function createMarkdownFile(
}
type CreateTaskArgs = {
+ shareWithTeam?: boolean;
/** Composite mutations revalidate after their final write. */
revalidateSoup?: boolean;
title?: string;
@@ -142,6 +143,7 @@ async function createTaskResponse(args?: CreateTaskArgs) {
// Create task, properties, and sync-service content in one backend-owned lifecycle.
const result = await storageServiceClient.createTask({
+ shareWithTeam: args?.shareWithTeam,
taskName: args?.title ?? '',
markdown: args?.content ?? '',
projectId: args?.projectId,
diff --git a/docs/AGENT_GUIDE/tasks.md b/docs/AGENT_GUIDE/tasks.md
index 634df29c5a..cecdee7142 100644
--- a/docs/AGENT_GUIDE/tasks.md
+++ b/docs/AGENT_GUIDE/tasks.md
@@ -81,6 +81,13 @@ filter sheets. Desktop uses the centered composer dialog.
`Add description...`, and property buttons: `Not Started` (status), `Priority`, assignee
chip (defaults to you), `Due Date`, `Change or select tags`, `Attach image or video`,
a `Create More` switch, and `Create Task Ctrl ↵`.
+ The `Shared with Team` row defaults to on and remembers your choice in local
+ storage across composer openings and page reloads. Its hint explains whether
+ the task will be visible to your whole team or only to you and the people you
+ share it with. The choice also applies to Create More, continuing in a split,
+ and tasks created from a project.
+ This row sits below the creation buttons, separated by an edge-to-edge divider.
+ A second divider separates it from Similar Tasks when matches are shown.
3. `type_text` the title, then press **Ctrl+Enter** to create (the `Create Task` button
enables once there is a title). Dialog also offers `Continue editing in split` to open the
task as a full document.