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(email): list only personal tags in the email view sidebar (#7283)
teo78bc9d717f01
diff --git a/apps/web/src/features/email-view/components/EmailSidebar.tsx b/apps/web/src/features/email-view/components/EmailSidebar.tsxindex 8e0d7db7b3..a8e608a263 100644--- a/apps/web/src/features/email-view/components/EmailSidebar.tsx+++ b/apps/web/src/features/email-view/components/EmailSidebar.tsx@@ -17,6 +17,7 @@ import UsersThreeIcon from '@phosphor/users-three.svg';import SignalIcon from '@phosphor/wave-sine.svg';import NoiseIcon from '@phosphor/waveform.svg';import { SidebarTagsSection } from '@property/tags/SidebarTagsSection';+import type { TagScope } from '@service-properties/generated/schemas/tagScope';import { pressHandlers } from '@ui';import { tourTarget } from '@ui/components/Tour';import { type Component, For, Show } from 'solid-js';@@ -28,6 +29,9 @@ import { EMAIL_TOUR } from '../tour';import type { EmailTab } from '../types';import { EmailInboxList } from './EmailInboxSelector';+// Email is personal, so the sidebar lists only the user's own tags.+const SIDEBAR_TAG_SCOPES: readonly TagScope[] = ['user'];+const TAB_ICONS: Record<EmailTab, Component<{ class?: string }>> = {important: SignalIcon,noise: NoiseIcon,@@ -146,6 +150,7 @@ export function EmailSidebar() {onActiveIdsChange={showTags}open={isSidebarSectionOpen('tags')}onOpenChange={(open) => setSidebarSectionOpen('tags', open)}+ scopes={SIDEBAR_TAG_SCOPES}/></div></ViewSidebar.Content>diff --git a/apps/web/src/features/property/tags/SidebarTagsSection.test.tsx b/apps/web/src/features/property/tags/SidebarTagsSection.test.tsxindex 31c0267da9..dfec8e96bf 100644--- a/apps/web/src/features/property/tags/SidebarTagsSection.test.tsx+++ b/apps/web/src/features/property/tags/SidebarTagsSection.test.tsx@@ -139,6 +139,57 @@ describe('SidebarTagsSection', () => {);});+ it('lists only the requested scopes, including nested team branches', () => {+ const withTeam = [+ ...TAG_SETS,+ {+ scope: 'team',+ definition: { id: 'team-definition' },+ options: [+ {+ id: 'shared',+ propertyDefinitionId: 'team-definition',+ displayOrder: 0,+ value: { type: 'string', value: 'Shared' },+ },+ {+ id: 'nested',+ propertyDefinitionId: 'team-definition',+ displayOrder: 1,+ value: { type: 'string', value: 'Clients/Acme' },+ },+ ],+ },+ ] as TagSetResponse[];++ renderSection({ scopes: ['user'] }, withTeam);++ expect(screen.queryByText('Shared')).toBeNull();+ expect(screen.queryByText('Clients')).toBeNull();+ expect(screen.getByRole('button', { name: 'Urgent' })).toBeTruthy();+ expect(screen.getByRole('button', { name: 'Later' })).toBeTruthy();+ });++ it('lists team tags when no scopes are requested', () => {+ renderSection({}, [+ ...TAG_SETS,+ {+ scope: 'team',+ definition: { id: 'team-definition' },+ options: [+ {+ id: 'shared',+ propertyDefinitionId: 'team-definition',+ displayOrder: 0,+ value: { type: 'string', value: 'Shared' },+ },+ ],+ },+ ] as TagSetResponse[]);++ expect(screen.getByRole('button', { name: 'Shared' })).toBeTruthy();+ });+it('explains an empty list instead of rendering no rows', () => {renderSection({}, []);diff --git a/apps/web/src/features/property/tags/SidebarTagsSection.tsx b/apps/web/src/features/property/tags/SidebarTagsSection.tsxindex c8bea147e0..ef47cd526c 100644--- a/apps/web/src/features/property/tags/SidebarTagsSection.tsx+++ b/apps/web/src/features/property/tags/SidebarTagsSection.tsx@@ -1,9 +1,10 @@import { CollapsibleSection, ViewSidebar } from '@app/components/view-shell';import PlusIcon from '@phosphor/plus.svg';import { useCurrentTeamQuery } from '@queries/team/teams';+import type { TagScope } from '@service-properties/generated/schemas/tagScope';import { createSignal, Show } from 'solid-js';import { TagTree } from './components/tag-tree';-import type { TagTreeNode } from './core/tag-tree';+import type { TagTreeNode, TreeTag } from './core/tag-tree';import { TagEditorDialog } from './TagEditorDialog';import { useTagTree } from './tag-sets-context';@@ -16,8 +17,18 @@ export type SidebarTagsSectionProps = {onOpenChange: (open: boolean) => void;/** Runs after a row is chosen, for hosts that show the section in a menu. */onNavigate?: () => void;+ /**+ * Tag sets the section lists. New tags are created in the first scope, and+ * the editor offers team sharing only when `team` is included. Defaults to+ * personal and team.+ */+ scopes?: readonly TagScope[];};+function nodeScope(node: TagTreeNode): TreeTag['scope'] | undefined {+ return node.tag?.scope ?? node.children.map(nodeScope).find(Boolean);+}+/*** A sidebar row is a destination, not a checkbox: choosing a tag shows that* tag alone, and choosing an active tag drops it from the selection.@@ -38,7 +49,15 @@ export function selectSidebarTag(* sets from the nearest `TagSetsProvider`.*/export function SidebarTagsSection(props: SidebarTagsSectionProps) {- const tree = useTagTree();+ const fullTree = useTagTree();+ const tree = () => {+ const scopes = props.scopes;+ if (!scopes) return fullTree();+ return fullTree().filter((node) => {+ const scope = nodeScope(node);+ return scope !== undefined && scopes.includes(scope);+ });+ };const [expanded, setExpanded] = createSignal<Record<string, boolean>>({});const containsActiveTag = (node: TagTreeNode): boolean =>Boolean(node.tag && props.activeIds.includes(node.tag.id)) ||@@ -52,7 +71,10 @@ export function SidebarTagsSection(props: SidebarTagsSectionProps) {const teamQuery = useCurrentTeamQuery();const [creating, setCreating] = createSignal(false);const teamAvailable = () =>- teamQuery.isSuccess && Boolean(teamQuery.data?.team);+ (props.scopes?.includes('team') ?? true) &&+ teamQuery.isSuccess &&+ Boolean(teamQuery.data?.team);+ const createScope = () => props.scopes?.[0] ?? 'user';return (<CollapsibleSection.Root@@ -95,7 +117,7 @@ export function SidebarTagsSection(props: SidebarTagsSectionProps) {</CollapsibleSection.Content><TagEditorDialogopen={creating()}- mode={{ type: 'create', initialScope: 'user' }}+ mode={{ type: 'create', initialScope: createScope() }}teamAvailable={teamAvailable()}onClose={() => setCreating(false)}/>diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex 50c2ae52ba..ace52d3fa0 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -374,6 +374,8 @@ The mobile task drawer retains its existing layout.Email's Tags sidebar uses the same [nested tag tree as Tasks](tasks.md#nested-sidebar-tags).Carets and folder-only parents expand branches; actual tags select their exact IDand switch the mailbox to All. Parent selection does not include descendant tags.+Unlike Tasks and Drive, it lists only personal tags; team-shared tags are hidden,+and its `New tag` action creates a personal tag with no Team sharing option.Full email client. Tabs: `Signal` / `Noise` / `Favorites` / `Sent` / `Scheduled` / `Calendar` / `Drafts` / `Shared` /`Archived` / `All`. Compose via the `Email` button (or `Create` → `Email E`). On a fresh local user it