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.

revert(channels): show support conversations to staff again (#9127)

Wolf Mermelsteinf4210bbde50b
diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsx
index a24650063d..f18cbf4d18 100644
--- a/apps/web/src/features/channels-view/channels-view-context.tsx
+++ b/apps/web/src/features/channels-view/channels-view-context.tsx
@@ -15,9 +15,8 @@ import { createPreviewSelectionGuard } from '@components/app/createPreviewSelect
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { enableChannelThreadsPreview } from '@core/constant/featureFlags';
import { createAssertedContextProvider } from '@core/context/createContext';
-import { useEmail, useUserId } from '@core/context/user';
+import { 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';
@@ -66,10 +65,6 @@ 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(
@@ -97,16 +92,11 @@ 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 &&
- initial.hideSupportChannels === undefined
- );
+ return initial.asideWidth === undefined && initial.sortBy === undefined;
}
export const [ChannelsViewProvider, useChannelsView] =
@@ -115,7 +105,6 @@ 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);
@@ -254,14 +243,6 @@ 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.tsx
index a6104cd2b2..b12efb4cf5 100644
--- a/apps/web/src/features/channels-view/channels-view.test.tsx
+++ b/apps/web/src/features/channels-view/channels-view.test.tsx
@@ -192,9 +192,6 @@ 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.tsx
index 0cc1db081e..313dd5a740 100644
--- a/apps/web/src/features/channels-view/channels-view.tsx
+++ b/apps/web/src/features/channels-view/channels-view.tsx
@@ -34,7 +34,6 @@ 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,
@@ -59,7 +58,6 @@ 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({
@@ -80,7 +78,6 @@ 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 (
@@ -147,14 +144,8 @@ function DesktopChannelThreads(props: { sources: ChannelsSources }) {
function ChannelsViewRoot() {
const panel = useSplitPanelOrThrow();
- const {
- state,
- tab,
- mobileLayout,
- selectedChannel,
- setAsideWidth,
- hideSupportChannels,
- } = useChannelsView();
+ const { state, tab, mobileLayout, selectedChannel, setAsideWidth } =
+ useChannelsView();
const threadsTab = () => !mobileLayout() && tab() === 'threads';
const [railSearchOpen, setRailSearchOpen] = createSignal(false);
@@ -167,8 +158,7 @@ function ChannelsViewRoot() {
if (scope === 'threads') return tab() === 'threads';
return tab() === 'browse';
},
- (group) => state.sortBy[group],
- hideSupportChannels
+ (group) => state.sortBy[group]
);
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.tsx
index 1a405e3ef6..ebf5848a79 100644
--- a/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx
+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx
@@ -65,13 +65,6 @@ 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.tsx
index f3b987580d..bb6cc682e5 100644
--- a/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx
+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx
@@ -40,7 +40,6 @@ 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';
@@ -180,7 +179,6 @@ 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.tsx
deleted file mode 100644
index 64255a1103..0000000000
--- a/apps/web/src/features/channels-view/components/HideSupportChannelsButton.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-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.tsx
index c818783b37..72c1815c72 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,9 +170,6 @@ 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.tsx
index 2334fe1e2b..6d9ee83d7d 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
@@ -66,7 +66,6 @@ import {
filterChannelLabelMembers,
} from '../../core/channel-label-eligibility';
import { resolveChannelLabelMemberships } from '../../core/smart-tags';
-import { isSupportChannel } from '../../core/support-channels';
import {
type ChannelsSourceScope,
type ChannelsSources,
@@ -154,7 +153,6 @@ export function ChannelsRail(props: ChannelsRailProps) {
threadsEnabled,
threadsChannelId,
setThreadsChannelId,
- hideSupportChannels,
} = useChannelsView();
const panel = useSplitPanelOrThrow();
@@ -363,9 +361,9 @@ export function ChannelsRail(props: ChannelsRailProps) {
return 'Channel labels are unavailable right now.';
};
- const allFavorites = createMemo(() => favoritesData()?.favorites ?? []);
+ const favorites = createMemo(() => favoritesData()?.favorites ?? []);
const favoriteChannelIds = createMemo(() =>
- allFavorites()
+ favorites()
.filter((favorite) => favorite.entityType === 'channel')
.map((favorite) => favorite.entityId)
);
@@ -399,11 +397,7 @@ 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))
- .filter(
- (channel) => !hideSupportChannels() || !isSupportChannel(channel)
- );
+ return referencedChannels().filter((channel) => labelled.has(channel.id));
});
const allChannels = createMemo(() =>
@@ -415,15 +409,6 @@ 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.tsx
index 59ddde7086..727a9c56d0 100644
--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
@@ -52,7 +52,6 @@ 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,
@@ -459,7 +458,6 @@ 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.ts
deleted file mode 100644
index 4ebe6e8d69..0000000000
--- a/apps/web/src/features/channels-view/core/support-channels.test.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-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.ts
deleted file mode 100644
index e177bd6362..0000000000
--- a/apps/web/src/features/channels-view/core/support-channels.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-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:
- | 'team_channels'
- | '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.ts
index 1331b96520..881cb1f633 100644
--- a/apps/web/src/features/channels-view/persistence.ts
+++ b/apps/web/src/features/channels-view/persistence.ts
@@ -95,7 +95,6 @@ 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>;
@@ -104,7 +103,6 @@ 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 {
@@ -199,7 +197,6 @@ function createChannelsPreferencesStorage(options: {
version: 1,
asideWidth: clampChannelsRailWidth(state.asideWidth),
sortBy: state.sortBy,
- hideSupportChannels: state.hideSupportChannels,
} satisfies ChannelsPreferences);
return {
@@ -222,14 +219,12 @@ 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.ts
index 715c6f052c..d14d522002 100644
--- a/apps/web/src/features/channels-view/queries.test.ts
+++ b/apps/web/src/features/channels-view/queries.test.ts
@@ -43,9 +43,6 @@ 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';
@@ -271,49 +268,6 @@ 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.ts
index 75f3c6dfbb..f0fdd73d00 100644
--- a/apps/web/src/features/channels-view/queries.ts
+++ b/apps/web/src/features/channels-view/queries.ts
@@ -4,7 +4,6 @@ import {
defineQueryFilters,
queryStateFrom,
} from '@app/features/next-soup/filters/filter-store';
-import { useChannelsContext } from '@core/context/channels';
import { useUserId } from '@core/context/user';
import { fireAndForget } from '@core/util/fireAndForget';
import {
@@ -21,12 +20,6 @@ import {
import { type Accessor, createEffect, createMemo } from 'solid-js';
import { sortChannels } from './core/channel-sort';
import { channelThreadsQueryArgs } from './core/channel-threads-query';
-import {
- applySupportChannelVisibility,
- channelEntityFromListItem,
- isSupportChannel,
- isSupportChannelName,
-} from './core/support-channels';
import type {
ChannelListSort,
ChannelsQueryScope,
@@ -42,9 +35,6 @@ 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,
@@ -243,8 +233,7 @@ export function resolveSelectedChannel(
*/
function useThreadChannelsDataSource(
enabled: Accessor<boolean>,
- sortMethod: Accessor<ChannelListSort>,
- hideSupportChannels: Accessor<boolean>
+ sortMethod: Accessor<ChannelListSort>
): ChannelsDataSource {
const userId = useUserId();
const threadsQuery = useSoupAstItemsQuery(
@@ -290,12 +279,10 @@ function useThreadChannelsDataSource(
.filter(isChannelEntity)
.map((channel) => [channel.id, channel])
);
- const listed = sortChannels(
+ return sortChannels(
channelIds().flatMap((id) => byId.get(id) ?? []),
sortMethod()
);
- if (!hideSupportChannels()) return listed;
- return listed.filter((channel) => !isSupportChannel(channel));
}, []);
return {
@@ -333,10 +320,8 @@ function useThreadChannelsDataSource(
function useChannelsDataSource(
scope: ChannelsListScope,
enabled: Accessor<boolean>,
- sortMethod: Accessor<ChannelListSort | undefined>,
- hideSupportChannels: Accessor<boolean>
+ sortMethod: Accessor<ChannelListSort | undefined>
): ChannelsDataSource {
- const list = useChannelsContext();
const query = useSoupAstItemsQuery(
() => channelsQueryArgs(scope, sortMethod()),
() => ({
@@ -345,56 +330,21 @@ 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 = applySupportChannelVisibility(
+ const channels = filterChannelsForScope(
scope,
- filterChannelsForScope(
- scope,
- (query.data?.entities ?? []).filter(isChannelEntity)
- ),
- extra(),
- hideSupportChannels()
+ (query.data?.entities ?? []).filter(isChannelEntity)
);
- if (scope === 'recents' || scope === 'search') return channels;
+ if (scope === 'recents') 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,
@@ -419,44 +369,37 @@ function useChannelsDataSource(
export function useChannelsSources(
enabled: (scope: ChannelsSourceScope) => boolean,
- sortBy: (group: ChannelsSortGroup) => ChannelListSort,
- hideSupportChannels: Accessor<boolean> = () => false
+ sortBy: (group: ChannelsSortGroup) => ChannelListSort
): ChannelsSources {
return {
team_channels: useChannelsDataSource(
'team_channels',
() => enabled('team_channels'),
- () => sortBy('team_channels'),
- hideSupportChannels
+ () => sortBy('team_channels')
),
channels: useChannelsDataSource(
'channels',
() => enabled('channels'),
- () => sortBy('channels'),
- hideSupportChannels
+ () => sortBy('channels')
),
direct_messages: useChannelsDataSource(
'direct_messages',
() => enabled('direct_messages'),
- () => sortBy('direct_messages'),
- hideSupportChannels
+ () => sortBy('direct_messages')
),
recents: useChannelsDataSource(
'recents',
() => enabled('recents'),
- () => undefined,
- hideSupportChannels
+ () => undefined
),
search: useChannelsDataSource(
'search',
() => enabled('search'),
- () => undefined,
- hideSupportChannels
+ () => undefined
),
threads: useThreadChannelsDataSource(
() => enabled('threads'),
- () => sortBy('threads'),
- hideSupportChannels
+ () => sortBy('threads')
),
};
}
diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.ts
index a9a052a866..ea73dddcf5 100644
--- a/apps/web/src/features/channels-view/types.ts
+++ b/apps/web/src/features/channels-view/types.ts
@@ -29,12 +29,6 @@ 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.ts
deleted file mode 100644
index bfe6c0f451..0000000000
--- a/apps/web/src/lib/core/user/staff.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/** 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.md
index 3b62b89b21..f0f7a61def 100644
--- a/docs/agent-guide/channels.md
+++ b/docs/agent-guide/channels.md
@@ -810,13 +810,7 @@ backdrop or `Escape` still dismisses it. There is no separate skinny sidebar mod
On desktop, the Chat rail has `All` and `Recent` tabs in a flat, shared track
aligned with New. Choices use equal widths, a transparent outlined track with
1px padding, and fully rounded pill shapes. The 32px selected state matches
-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
+New's fill and border without an extra shadow. All contains an optional
`Favorites` section and the
independently paginated `Team channels`, `Channels`, and `DMs` sections, in
that order. `Team channels` lists team channels; `Channels` lists every other