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(channels): hide support conversations for staff (#9097)
Wolf Mermelstein5119de5610bb
diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsxindex f18cbf4d18..a24650063d 100644--- a/apps/web/src/features/channels-view/channels-view-context.tsx+++ b/apps/web/src/features/channels-view/channels-view-context.tsx@@ -15,8 +15,9 @@ import { createPreviewSelectionGuard } from '@components/app/createPreviewSelectimport { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { enableChannelThreadsPreview } from '@core/constant/featureFlags';import { createAssertedContextProvider } from '@core/context/createContext';-import { useUserId } from '@core/context/user';+import { useEmail, useUserId } from '@core/context/user';import { isTouchDevice } from '@core/mobile/isTouchDevice';+import { isMacroStaffEmail } from '@core/user/staff';import { fireAndForget } from '@core/util/fireAndForget';import type { ContextProviderProps } from '@solid-primitives/context';import { type Accessor, createEffect, createMemo, on } from 'solid-js';@@ -65,6 +66,10 @@ export type ChannelsViewContext = {setLabelOpen: (labelId: string, open: boolean) => void;setSortBy: (group: ChannelsSortGroup, sort: ChannelListSort) => void;setAsideWidth: (width: number) => void;+ /** Staff accounts on the company domain can hide support conversations. */+ canHideSupportChannels: Accessor<boolean>;+ hideSupportChannels: Accessor<boolean>;+ setHideSupportChannels: (hide: boolean) => void;};function createInitialState(@@ -92,11 +97,16 @@ function createInitialState(asideWidth: clampChannelsRailWidth(initial.asideWidth ?? CHANNELS_DEFAULT_RAIL_WIDTH),+ hideSupportChannels: initial.hideSupportChannels ?? true,};}function shouldRestorePreferences(initial: ChannelsViewStateOptions): boolean {- return initial.asideWidth === undefined && initial.sortBy === undefined;+ return (+ initial.asideWidth === undefined &&+ initial.sortBy === undefined &&+ initial.hideSupportChannels === undefined+ );}export const [ChannelsViewProvider, useChannelsView] =@@ -105,6 +115,7 @@ export const [ChannelsViewProvider, useChannelsView] =(props) => {const panel = useSplitPanelOrThrow();const userId = useUserId();+ const email = useEmail();const navigate = useNavigate();const params = useRouteParams(channelDetailRoute);const [search, setSearch] = createSearchParams(channelsSearch);@@ -243,6 +254,14 @@ export const [ChannelsViewProvider, useChannelsView] =setSortBy: (group, sort) => setState('sortBy', group, sort),setAsideWidth: (width) =>setState('asideWidth', clampChannelsRailWidth(width)),+ canHideSupportChannels: () => isMacroStaffEmail(email()),+ hideSupportChannels: () =>+ isMacroStaffEmail(email()) && state.hideSupportChannels,+ setHideSupportChannels: (hide) => {+ if (!isMacroStaffEmail(email())) return;+ if (state.hideSupportChannels === hide) return;+ setState('hideSupportChannels', hide);+ },};});diff --git a/apps/web/src/features/channels-view/channels-view.test.tsx b/apps/web/src/features/channels-view/channels-view.test.tsxindex b12efb4cf5..a6104cd2b2 100644--- a/apps/web/src/features/channels-view/channels-view.test.tsx+++ b/apps/web/src/features/channels-view/channels-view.test.tsx@@ -192,6 +192,9 @@ vi.mock('./channels-view-context', () => ({}: undefined,setAsideWidth: vi.fn(),+ hideSupportChannels: () => false,+ canHideSupportChannels: () => false,+ setHideSupportChannels: vi.fn(),}),}));vi.mock('./queries', () => ({diff --git a/apps/web/src/features/channels-view/channels-view.tsx b/apps/web/src/features/channels-view/channels-view.tsxindex 313dd5a740..0cc1db081e 100644--- a/apps/web/src/features/channels-view/channels-view.tsx+++ b/apps/web/src/features/channels-view/channels-view.tsx@@ -34,6 +34,7 @@ import { MAX_PINNED_CHANNELS } from './components/ChannelPins';import { ChannelsMobileView } from './components/ChannelsMobileView';import { ChannelThreadsView } from './components/ChannelThreadsView';import { ChannelsRail } from './components/rail/ChannelsRail';+import { isSupportChannel } from './core/support-channels';import { createChannelDetail } from './primitives/create-channel-detail';import {type ChannelsSources,@@ -58,6 +59,7 @@ export type ChannelsViewProps = {// Mounted inside the mobile list's Suspense boundary.function MobileChannelsList(props: { sources: ChannelsSources }) {+ const { hideSupportChannels } = useChannelsView();const listChannels = useChannelListSearchPool();const mobileSearchText = () => '';const mobileSearchSource = createChannelSearchSource({@@ -78,6 +80,7 @@ function MobileChannelsList(props: { sources: ChannelsSources }) {return (favoritesData()?.favorites ?? []).filter((favorite) => favorite.entityType === 'channel').flatMap((favorite) => channelsById.get(favorite.entityId) ?? [])+ .filter((channel) => !hideSupportChannels() || !isSupportChannel(channel)).slice(0, MAX_PINNED_CHANNELS);});return (@@ -144,8 +147,14 @@ function DesktopChannelThreads(props: { sources: ChannelsSources }) {function ChannelsViewRoot() {const panel = useSplitPanelOrThrow();- const { state, tab, mobileLayout, selectedChannel, setAsideWidth } =- useChannelsView();+ const {+ state,+ tab,+ mobileLayout,+ selectedChannel,+ setAsideWidth,+ hideSupportChannels,+ } = useChannelsView();const threadsTab = () => !mobileLayout() && tab() === 'threads';const [railSearchOpen, setRailSearchOpen] = createSignal(false);@@ -158,7 +167,8 @@ function ChannelsViewRoot() {if (scope === 'threads') return tab() === 'threads';return tab() === 'browse';},- (group) => state.sortBy[group]+ (group) => state.sortBy[group],+ hideSupportChannels);onMount(() => panel.handle.setDisplayName('Channels'));diff --git a/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx b/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsxindex ebf5848a79..1a405e3ef6 100644--- a/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx@@ -65,6 +65,13 @@ vi.mock('@core/component/Toast/Toast', () => ({toast: { failure: mocks.failure },}));vi.mock('@core/context/user', () => ({ useUserId: () => () => 'viewer' }));+vi.mock('../channels-view-context', () => ({+ useChannelsView: () => ({+ canHideSupportChannels: () => false,+ hideSupportChannels: () => false,+ setHideSupportChannels: vi.fn(),+ }),+}));vi.mock('@entity', () => ({ Entity: { Icon: () => null } }));vi.mock('@entity/composed/list-entity/shared', () => ({InboxDivider: () => <hr />,diff --git a/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsxindex bb6cc682e5..f3b987580d 100644--- a/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx@@ -40,6 +40,7 @@ import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';import type { ChannelsDataSource } from '../queries';import { ChannelPin, ChannelPinGrid } from './ChannelPins';import { ChannelsEmptyState } from './ChannelsEmptyState';+import { HideSupportChannelsMobileButton } from './HideSupportChannelsButton';import { IncomingCallActions } from './rail/ChannelRailItems';import { useChannelCalls } from './rail/hooks/useChannelCalls';import { useChannelRailActivity } from './rail/hooks/useChannelRailActivity';@@ -179,6 +180,7 @@ export function ChannelsMobileView(props: {aria-hidden="true"class="h-[calc(var(--mobile-content-inset-top,0px)+0.75rem)]"/>+ <HideSupportChannelsMobileButton /><Show when={pinned().length > 0}><ChannelPinGrid><For each={pinned()}>diff --git a/apps/web/src/features/channels-view/components/HideSupportChannelsButton.tsx b/apps/web/src/features/channels-view/components/HideSupportChannelsButton.tsxnew file mode 100644index 0000000000..64255a1103--- /dev/null+++ b/apps/web/src/features/channels-view/components/HideSupportChannelsButton.tsx@@ -0,0 +1,53 @@+import { Button } from '@ui';+import { Show } from 'solid-js';+import { useChannelsView } from '../channels-view-context';++function hideSupportChannelsLabel(hidden: boolean) {+ return hidden ? 'Show support channels' : 'Hide support channels';+}++export function HideSupportChannelsButton() {+ const {+ canHideSupportChannels,+ hideSupportChannels,+ setHideSupportChannels,+ } = useChannelsView();+ const label = () => hideSupportChannelsLabel(hideSupportChannels());++ return (+ <Show when={canHideSupportChannels()}>+ <Button+ variant="secondary"+ size="sm"+ aria-pressed={hideSupportChannels()}+ class="w-full"+ onClick={() => setHideSupportChannels(!hideSupportChannels())}+ >+ {label()}+ </Button>+ </Show>+ );+}++export function HideSupportChannelsMobileButton() {+ const {+ canHideSupportChannels,+ hideSupportChannels,+ setHideSupportChannels,+ } = useChannelsView();++ return (+ <Show when={canHideSupportChannels()}>+ <div class="flex justify-end px-(--mobile-chrome-gutter) pb-2">+ <Button+ variant="secondary"+ size="sm"+ aria-pressed={hideSupportChannels()}+ onClick={() => setHideSupportChannels(!hideSupportChannels())}+ >+ {hideSupportChannelsLabel(hideSupportChannels())}+ </Button>+ </div>+ </Show>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsxindex 72c1815c72..c818783b37 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx@@ -170,6 +170,9 @@ vi.mock('../../channels-view-context', () => ({threadsEnabled: () => false,selectedChannel: () => mocks.selected,setSelectedChannel: mocks.select,+ hideSupportChannels: () => false,+ canHideSupportChannels: () => false,+ setHideSupportChannels: vi.fn(),}),}));vi.mock('../../queries', () => ({diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsxindex 6d9ee83d7d..2334fe1e2b 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx@@ -66,6 +66,7 @@ import {filterChannelLabelMembers,} from '../../core/channel-label-eligibility';import { resolveChannelLabelMemberships } from '../../core/smart-tags';+import { isSupportChannel } from '../../core/support-channels';import {type ChannelsSourceScope,type ChannelsSources,@@ -153,6 +154,7 @@ export function ChannelsRail(props: ChannelsRailProps) {threadsEnabled,threadsChannelId,setThreadsChannelId,+ hideSupportChannels,} = useChannelsView();const panel = useSplitPanelOrThrow();@@ -361,9 +363,9 @@ export function ChannelsRail(props: ChannelsRailProps) {return 'Channel labels are unavailable right now.';};- const favorites = createMemo(() => favoritesData()?.favorites ?? []);+ const allFavorites = createMemo(() => favoritesData()?.favorites ?? []);const favoriteChannelIds = createMemo(() =>- favorites()+ allFavorites().filter((favorite) => favorite.entityType === 'channel').map((favorite) => favorite.entityId));@@ -397,7 +399,11 @@ export function ChannelsRail(props: ChannelsRailProps) {const labelledChannels = createMemo<ChannelEntity[]>(() => {if (!channelTagsEnabled()) return [];const labelled = new Set(labels().flatMap((label) => label.channelIds));- return referencedChannels().filter((channel) => labelled.has(channel.id));+ return referencedChannels()+ .filter((channel) => labelled.has(channel.id))+ .filter(+ (channel) => !hideSupportChannels() || !isSupportChannel(channel)+ );});const allChannels = createMemo(() =>@@ -409,6 +415,15 @@ export function ChannelsRail(props: ChannelsRailProps) {const channelById = (channelId: string) =>channelsById().get(channelId) ??referencedChannels().find((channel) => channel.id === channelId);+ const favorites = createMemo(() => {+ const all = allFavorites();+ if (!hideSupportChannels()) return all;+ return all.filter((favorite) => {+ if (favorite.entityType !== 'channel') return true;+ const channel = channelById(favorite.entityId);+ return channel === undefined || !isSupportChannel(channel);+ });+ });const channelActivity = useChannelRailActivity(allChannels, channelCalls);diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsxindex 727a9c56d0..59ddde7086 100644--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx@@ -52,6 +52,7 @@ import type {import { channelMentionsUser, formatDetailedTimestamp } from '../../utils';import { ChannelsEmptyState } from '../ChannelsEmptyState';import { ConversationsCreateMenu } from '../ConversationsCreateMenu';+import { HideSupportChannelsButton } from '../HideSupportChannelsButton';import { ChannelFavoritesSection } from './ChannelFavoriteRows';import {ChannelLabelMenuItems,@@ -458,6 +459,7 @@ function ExpandedHeader(props: { search: ChannelRailSearch }) {</ViewSidebar.Control></Show></ViewSidebar.Toolbar>+ <HideSupportChannelsButton /></ViewSidebar.Primary><Show when={isTouchDevice() && props.search.isOpen()}><div class="px-(--sidebar-content-inset) pt-(--sidebar-gutter)">diff --git a/apps/web/src/features/channels-view/core/support-channels.test.ts b/apps/web/src/features/channels-view/core/support-channels.test.tsnew file mode 100644index 0000000000..4ebe6e8d69--- /dev/null+++ b/apps/web/src/features/channels-view/core/support-channels.test.ts@@ -0,0 +1,73 @@+import type { ChannelEntity } from '@entity';+import { describe, expect, it } from 'vitest';+import {+ applySupportChannelVisibility,+ isSupportChannel,+ isSupportChannelName,+ SUPPORT_CHANNEL_NAME_PREFIX,+} from './support-channels';++const channel = (+ id: string,+ name: string,+ channelType: ChannelEntity['channelType'] = 'private'+): ChannelEntity => ({+ id,+ name,+ type: 'channel',+ ownerId: 'viewer',+ channelType,+});++const support = channel('support', 'Macro Support x acme');+const team = channel('eng', 'Engineering', 'team');+const hashed = channel('hashed', '#Macro Support x acme');++describe('isSupportChannelName', () => {+ it('matches the seeded support conversation prefix', () => {+ expect(isSupportChannelName(`${SUPPORT_CHANNEL_NAME_PREFIX}ada`)).toBe(+ true+ );+ expect(isSupportChannelName('#Macro Support x ada')).toBe(true);+ expect(isSupportChannelName('Engineering')).toBe(false);+ expect(isSupportChannelName('Macro Support')).toBe(false);+ expect(isSupportChannelName(undefined)).toBe(false);+ expect(isSupportChannelName(null)).toBe(false);+ });+});++describe('applySupportChannelVisibility', () => {+ it('leaves search and visible lists unchanged', () => {+ expect(+ applySupportChannelVisibility('search', [support, team], [], true)+ ).toEqual([support, team]);+ expect(+ applySupportChannelVisibility('channels', [support, team], [], false)+ ).toEqual([support, team]);+ });++ it('drops support conversations from Chat lists', () => {+ expect(+ applySupportChannelVisibility(+ 'recents',+ [support, team, hashed],+ [],+ true+ )+ ).toEqual([team]);+ });++ it('fills All from the complete list when hiding support', () => {+ const extra = channel('internal', 'Internal', 'team');+ expect(+ applySupportChannelVisibility('channels', [support], [extra, team], true)+ ).toEqual([extra, team]);+ });+});++describe('isSupportChannel', () => {+ it('uses the conversation name', () => {+ expect(isSupportChannel(support)).toBe(true);+ expect(isSupportChannel(team)).toBe(false);+ });+});diff --git a/apps/web/src/features/channels-view/core/support-channels.ts b/apps/web/src/features/channels-view/core/support-channels.tsnew file mode 100644index 0000000000..347b6e066b--- /dev/null+++ b/apps/web/src/features/channels-view/core/support-channels.ts@@ -0,0 +1,60 @@+import type { ChannelEntity } from '@entity';+import type { ApiChannelWithLatest } from '@service-storage/channel-list-types';++/** Signup support conversations are named this way on the server. */+export const SUPPORT_CHANNEL_NAME_PREFIX = 'Macro Support x ';++export function isSupportChannelName(name: string | null | undefined): boolean {+ if (!name) return false;+ return name+ .replace(/^#+/, '')+ .trimStart()+ .startsWith(SUPPORT_CHANNEL_NAME_PREFIX);+}++export function isSupportChannel(channel: { name?: string | null }): boolean {+ return isSupportChannelName(channel.name);+}++export function channelEntityFromListItem(+ channel: ApiChannelWithLatest+): ChannelEntity {+ return {+ id: channel.id,+ type: 'channel',+ name: channel.agent_dm?.name ?? (channel.name || 'Unknown Channel'),+ ownerId: channel.owner_id,+ channelType: channel.channel_type,+ isParticipant: channel.is_participant,+ participantIds: channel.participants.map(+ (participant) => participant.user_id+ ),+ createdAt: channel.created_at,+ updatedAt: channel.updated_at,+ viewedAt: channel.viewed_at ?? null,+ interactedAt: channel.interacted_at ?? null,+ };+}++/**+ * Drop support conversations from Chat lists. Search stays unfiltered so+ * staff can still open one by name. The complete channel list fills All+ * when the paged source is mostly support conversations.+ */+export function applySupportChannelVisibility(+ scope: 'channels' | 'direct_messages' | 'recents' | 'search',+ channels: readonly ChannelEntity[],+ extra: readonly ChannelEntity[],+ hide: boolean+): ChannelEntity[] {+ if (scope === 'search' || !hide) return [...channels];++ const visible = channels.filter((channel) => !isSupportChannel(channel));+ if (scope !== 'channels' || extra.length === 0) return visible;++ const byId = new Map<string, ChannelEntity>();+ for (const channel of [...visible, ...extra]) {+ if (!byId.has(channel.id)) byId.set(channel.id, channel);+ }+ return [...byId.values()];+}diff --git a/apps/web/src/features/channels-view/persistence.ts b/apps/web/src/features/channels-view/persistence.tsindex 881cb1f633..1331b96520 100644--- a/apps/web/src/features/channels-view/persistence.ts+++ b/apps/web/src/features/channels-view/persistence.ts@@ -95,6 +95,7 @@ const channelsPreferencesSchema = z.object({.default(CHANNELS_DEFAULT_SORT_BY.threads),}).default(CHANNELS_DEFAULT_SORT_BY),+ hideSupportChannels: z.boolean().default(true),});type ChannelsPreferences = z.infer<typeof channelsPreferencesSchema>;@@ -103,6 +104,7 @@ const DEFAULT_CHANNELS_PREFERENCES = {version: 1,asideWidth: CHANNELS_DEFAULT_RAIL_WIDTH,sortBy: CHANNELS_DEFAULT_SORT_BY,+ hideSupportChannels: true,} satisfies ChannelsPreferences;function selectEntryState(state: ChannelsViewState): ChannelsEntryState {@@ -197,6 +199,7 @@ function createChannelsPreferencesStorage(options: {version: 1,asideWidth: clampChannelsRailWidth(state.asideWidth),sortBy: state.sortBy,+ hideSupportChannels: state.hideSupportChannels,} satisfies ChannelsPreferences);return {@@ -219,12 +222,14 @@ function createChannelsPreferencesStorage(options: {...current,asideWidth: restored.asideWidth,sortBy: restored.sortBy,+ hideSupportChannels: restored.hideSupportChannels,};} catch {return {...current,asideWidth: DEFAULT_CHANNELS_PREFERENCES.asideWidth,sortBy: DEFAULT_CHANNELS_PREFERENCES.sortBy,+ hideSupportChannels: DEFAULT_CHANNELS_PREFERENCES.hideSupportChannels,};}},diff --git a/apps/web/src/features/channels-view/queries.test.ts b/apps/web/src/features/channels-view/queries.test.tsindex d14d522002..715c6f052c 100644--- a/apps/web/src/features/channels-view/queries.test.ts+++ b/apps/web/src/features/channels-view/queries.test.ts@@ -43,6 +43,9 @@ vi.mock('@entity', () => ({entity.type === 'channel_thread',}));vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user-1' }));+vi.mock('@core/context/channels', () => ({+ useChannelsContext: () => ({ channels: () => [] }),+}));import { useChannelByIdQuery } from '@channel/Channel/channel-entity';import { resolveReferencedChannels, useChannelsSources } from './queries';@@ -268,6 +271,49 @@ describe('Threads rail source', () => {});});+describe('hidden support conversations', () => {+ it('drops support conversations from Recent and keeps them in search', () => {+ const support = {+ type: 'channel',+ id: 'support',+ name: 'Macro Support x acme',+ latestRootMessage: { id: 'm1' },+ };+ const team = {+ type: 'channel',+ id: 'eng',+ name: 'Engineering',+ latestRootMessage: { id: 'm2' },+ };+ useSoupAstItemsQuery.mockImplementation(+ () =>+ ({+ isEnabled: true,+ isPending: false,+ isLoading: false,+ data: { entities: [support, team] },+ }) as never+ );+ const dispose = createRoot((dispose) => {+ const sources = useChannelsSources(+ (scope) => scope === 'recents' || scope === 'search',+ () => 'updated_at',+ () => true+ );+ expect(sources.recents.items().map((channel) => channel.id)).toEqual([+ 'eng',+ ]);+ expect(sources.search.items().map((channel) => channel.id)).toEqual([+ 'support',+ 'eng',+ ]);+ return dispose;+ });+ dispose();+ useSoupAstItemsQuery.mockReset();+ });+});+describe('Threads rail paging', () => {it('keeps paging on its own while the list may be too short to scroll', () => {const fetchNextPage = vi.fn(async () => {});diff --git a/apps/web/src/features/channels-view/queries.ts b/apps/web/src/features/channels-view/queries.tsindex 0f92dd6d68..d2f2c4b57f 100644--- a/apps/web/src/features/channels-view/queries.ts+++ b/apps/web/src/features/channels-view/queries.ts@@ -4,6 +4,7 @@ import {defineQueryFilters,queryStateFrom,} from '@app/features/next-soup/filters/filter-store';+import { useChannelsContext } from '@core/context/channels';import { useUserId } from '@core/context/user';import { compareDateDesc } from '@core/util/date';import { fireAndForget } from '@core/util/fireAndForget';@@ -20,6 +21,12 @@ import {} from '@queries/soup/items';import { type Accessor, createEffect, createMemo } from 'solid-js';import { channelThreadsQueryArgs } from './core/channel-threads-query';+import {+ applySupportChannelVisibility,+ channelEntityFromListItem,+ isSupportChannel,+ isSupportChannelName,+} from './core/support-channels';import type {ChannelListSort,ChannelsQueryScope,@@ -35,6 +42,9 @@ const THREAD_CHANNELS_PAGE_SIZE = 100;* scrolling the rail loads the rest.*/const THREAD_CHANNELS_AUTO_PAGES = 5;+/** Pages Recent loads on its own after hiding support conversations. */+const HIDDEN_SUPPORT_AUTO_PAGES = 8;+const HIDDEN_SUPPORT_MIN_VISIBLE = 30;const CHANNELS_QUERY_PARAMS = {limit: 100,@@ -249,7 +259,8 @@ function sortChannels(*/function useThreadChannelsDataSource(enabled: Accessor<boolean>,- sortMethod: Accessor<ChannelListSort>+ sortMethod: Accessor<ChannelListSort>,+ hideSupportChannels: Accessor<boolean>): ChannelsDataSource {const userId = useUserId();const threadsQuery = useSoupAstItemsQuery(@@ -295,10 +306,12 @@ function useThreadChannelsDataSource(.filter(isChannelEntity).map((channel) => [channel.id, channel]));- return sortChannels(+ const listed = sortChannels(channelIds().flatMap((id) => byId.get(id) ?? []),sortMethod());+ if (!hideSupportChannels()) return listed;+ return listed.filter((channel) => !isSupportChannel(channel));}, []);return {@@ -336,8 +349,10 @@ function useThreadChannelsDataSource(function useChannelsDataSource(scope: ChannelsListScope,enabled: Accessor<boolean>,- sortMethod: Accessor<ChannelListSort | undefined>+ sortMethod: Accessor<ChannelListSort | undefined>,+ hideSupportChannels: Accessor<boolean>): ChannelsDataSource {+ const list = useChannelsContext();const query = useSoupAstItemsQuery(() => channelsQueryArgs(scope, sortMethod()),() => ({@@ -346,21 +361,56 @@ function useChannelsDataSource(graphqlProjection: 'channel-list',}));+ const extra = createMemo(() => {+ if (!hideSupportChannels() || scope !== 'channels') return [];+ return list+ .channels()+ .filter(+ (channel) =>+ channel.channel_type !== 'direct_message' &&+ !isSupportChannelName(channel.name)+ )+ .map(channelEntityFromListItem);+ });const items = createMemo<ChannelEntity[]>((previous) => {if (!query.isEnabled || query.isPending) return previous;- const channels = filterChannelsForScope(+ const channels = applySupportChannelVisibility(scope,- (query.data?.entities ?? []).filter(isChannelEntity)+ filterChannelsForScope(+ scope,+ (query.data?.entities ?? []).filter(isChannelEntity)+ ),+ extra(),+ hideSupportChannels());- if (scope === 'recents') return channels;+ if (scope === 'recents' || scope === 'search') return channels;return sortChannels(channels,sortMethod() ?? CHANNELS_QUERY_DEFINITIONS[scope].params.sort_method);}, []);+ createEffect(() => {+ if (+ !hideSupportChannels() ||+ scope !== 'recents' ||+ !query.isEnabled ||+ query.isLoading ||+ query.isFetching ||+ query.error ||+ !query.hasNextPage+ ) {+ return;+ }+ const loaded = query.data?.entities.length ?? 0;+ if (loaded >= CHANNELS_QUERY_PARAMS.limit * HIDDEN_SUPPORT_AUTO_PAGES) {+ return;+ }+ if (items().length >= HIDDEN_SUPPORT_MIN_VISIBLE) return;+ fireAndForget(query.fetchNextPage(), 'channels-view');+ });return {items,@@ -385,7 +435,8 @@ function useChannelsDataSource(export function useChannelsSources(enabled: (scope: ChannelsSourceScope) => boolean,- sortBy: (group: ChannelsSortGroup) => ChannelListSort+ sortBy: (group: ChannelsSortGroup) => ChannelListSort,+ hideSupportChannels: Accessor<boolean> = () => false): ChannelsSources {return {team_channels: useChannelsDataSource(@@ -396,26 +447,31 @@ export function useChannelsSources(channels: useChannelsDataSource('channels',() => enabled('channels'),- () => sortBy('channels')+ () => sortBy('channels'),+ hideSupportChannels),direct_messages: useChannelsDataSource('direct_messages',() => enabled('direct_messages'),- () => sortBy('direct_messages')+ () => sortBy('direct_messages'),+ hideSupportChannels),recents: useChannelsDataSource('recents',() => enabled('recents'),- () => undefined+ () => undefined,+ hideSupportChannels),search: useChannelsDataSource('search',() => enabled('search'),- () => undefined+ () => undefined,+ hideSupportChannels),threads: useThreadChannelsDataSource(() => enabled('threads'),- () => sortBy('threads')+ () => sortBy('threads'),+ hideSupportChannels),};}diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.tsindex ea73dddcf5..a9a052a866 100644--- a/apps/web/src/features/channels-view/types.ts+++ b/apps/web/src/features/channels-view/types.ts@@ -29,6 +29,12 @@ export type ChannelsViewState = {threadsChannelId: string | undefined;sortBy: Record<ChannelsSortGroup, ChannelListSort>;asideWidth: number;+ /**+ * Staff-only: hide seeded `Macro Support x …` conversations in Chat lists.+ * Search still finds them. Default on so those conversations do not bury+ * the rest of the sidebar.+ */+ hideSupportChannels: boolean;};export type ChannelsViewStateOptions = Partial<diff --git a/apps/web/src/lib/core/user/staff.ts b/apps/web/src/lib/core/user/staff.tsnew file mode 100644index 0000000000..bfe6c0f451--- /dev/null+++ b/apps/web/src/lib/core/user/staff.ts@@ -0,0 +1,14 @@+/** Company staff sign in with this exact email domain. */+const MACRO_STAFF_DOMAIN = 'macro.com';++/** The part after `@`, lowercased — `undefined` when it isn't an address. */+function emailDomain(address: string | undefined): string | undefined {+ const at = address?.lastIndexOf('@') ?? -1;+ if (!address || at < 1 || at === address.length - 1) return undefined;+ return address.slice(at + 1).toLowerCase();+}++/** Whether the address belongs to a Macro staff account (`@macro.com`). */+export function isMacroStaffEmail(address: string | undefined): boolean {+ return emailDomain(address?.trim()) === MACRO_STAFF_DOMAIN;+}diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.mdindex f0f7a61def..3b62b89b21 100644--- a/docs/agent-guide/channels.md+++ b/docs/agent-guide/channels.md@@ -810,7 +810,13 @@ backdrop or `Escape` still dismisses it. There is no separate skinny sidebar modOn desktop, the Chat rail has `All` and `Recent` tabs in a flat, shared trackaligned with New. Choices use equal widths, a transparent outlined track with1px padding, and fully rounded pill shapes. The 32px selected state matches-New's fill and border without an extra shadow. All contains an optional+New's fill and border without an extra shadow. Staff accounts on the company+domain see a labeled **Hide support channels** / **Show support channels**+button under those tabs (and the same action on the mobile Recent list). It+hides seeded `Macro Support x …`+conversations from All, Recent, favorites, Threads, and the mobile list so+regular channels stay findable; search still returns them. The choice is saved+per user and defaults to hidden. All contains an optional`Favorites` section and theindependently paginated `Team channels`, `Channels`, and `DMs` sections, inthat order. `Team channels` lists team channels; `Channels` lists every other