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(home): unify chats and agents filters into single agents filter (#8618)

gbirman2b37976040d2
diff --git a/apps/web/src/features/home/components/HomeFilters.tsx b/apps/web/src/features/home/components/HomeFilters.tsx
index 4ca43d0aab..e03ee565f3 100644
--- a/apps/web/src/features/home/components/HomeFilters.tsx
+++ b/apps/web/src/features/home/components/HomeFilters.tsx
@@ -61,17 +61,6 @@ const FILTER_ICONS = new Map<string, () => JSX.Element>([
/>
),
],
- [
- 'chats',
- () => (
- <EntityIcon
- targetType="chat"
- size="xs"
- theme="monochrome"
- class="text-ink-muted"
- />
- ),
- ],
[
'agents',
() => (
diff --git a/apps/web/src/features/home/home-facets.ts b/apps/web/src/features/home/home-facets.ts
index e336daf04a..c1f2f499e4 100644
--- a/apps/web/src/features/home/home-facets.ts
+++ b/apps/web/src/features/home/home-facets.ts
@@ -103,17 +103,15 @@ const typeOptions: Record<HomeTypeFilter, HomeFacetOption> = {
entity.type === 'channel_message' ||
entity.type === 'channel_thread',
},
- chats: {
- id: 'chats',
- label: 'Chats',
- clause: { cf: clause.not(clause.eq('chatId', NIL_UUID)) },
- predicate: (entity) => entity.type === 'chat',
- },
agents: {
id: 'agents',
label: 'Agents',
- clause: { asf: clause.not(clause.eq('agentSessionId', NIL_UUID)) },
- predicate: (entity) => entity.type === 'agent_session',
+ clause: {
+ cf: clause.not(clause.eq('chatId', NIL_UUID)),
+ asf: clause.not(clause.eq('agentSessionId', NIL_UUID)),
+ },
+ predicate: (entity) =>
+ entity.type === 'agent_session' || entity.type === 'chat',
},
projects: {
id: 'projects',
diff --git a/apps/web/src/features/home/persistence.ts b/apps/web/src/features/home/persistence.ts
index ad360101f4..670f6746df 100644
--- a/apps/web/src/features/home/persistence.ts
+++ b/apps/web/src/features/home/persistence.ts
@@ -25,6 +25,9 @@ export function normalizeHomeFacets(raw: unknown) {
) {
delete facets.read;
}
+ if (facets.type?.includes('chats')) {
+ facets.type = facets.type.map((t) => (t === 'chats' ? 'agents' : t));
+ }
return facets;
}
diff --git a/apps/web/src/features/home/queries/home-search.ts b/apps/web/src/features/home/queries/home-search.ts
index c5b643488e..420ebb32bf 100644
--- a/apps/web/src/features/home/queries/home-search.ts
+++ b/apps/web/src/features/home/queries/home-search.ts
@@ -17,7 +17,6 @@ const tabTypes: Record<HomeTab, ReadonlySet<HomeTypeFilter>> = {
'tasks',
'email',
'channels',
- 'chats',
'agents',
'projects',
'github',
@@ -105,7 +104,18 @@ export function buildHomeSearchRequest(
}
if (types.has('agents')) {
- filters.agent_session_filters = { include: true };
+ const agentSessionFilters: NonNullable<
+ EntityFilters['agent_session_filters']
+ > = { include: true };
+
+ const chatFilters: NonNullable<EntityFilters['chat_filters']> = {};
+
+ if (hasNotificationFilter) {
+ chatFilters.notification_filters = notificationFilters;
+ }
+
+ filters.agent_session_filters = agentSessionFilters;
+ filters.chat_filters = chatFilters;
}
if (types.has('channels')) {
@@ -128,16 +138,6 @@ export function buildHomeSearchRequest(
};
}
- if (types.has('chats')) {
- const chatFilters: NonNullable<EntityFilters['chat_filters']> = {};
-
- if (hasNotificationFilter) {
- chatFilters.notification_filters = notificationFilters;
- }
-
- filters.chat_filters = chatFilters;
- }
-
if (documentTypes.length > 0) {
const documentFilters: NonNullable<EntityFilters['document_filters']> = {};
diff --git a/apps/web/src/features/home/queries/use-home-query.test.ts b/apps/web/src/features/home/queries/use-home-query.test.ts
index a0ffeb127b..2ffb28a698 100644
--- a/apps/web/src/features/home/queries/use-home-query.test.ts
+++ b/apps/web/src/features/home/queries/use-home-query.test.ts
@@ -480,7 +480,7 @@ describe('Home data source', () => {
expect(activity.fetchNextPage).not.toHaveBeenCalled();
});
- it('can select chats and agent sessions independently', () => {
+ it('selects both chats and agent sessions with the agents filter', () => {
const activity = makeQuery(
[
{
@@ -503,10 +503,8 @@ describe('Home data source', () => {
false
);
const { source, setState } = mount(makeQuery([], false), activity);
- setState('facets', { type: ['chats'] });
- expect(ids(source)).toEqual(['chat']);
setState('facets', { type: ['agents'] });
- expect(ids(source)).toEqual(['agent']);
+ expect(ids(source)).toEqual(['agent', 'chat']);
});
});
diff --git a/apps/web/src/features/home/types.ts b/apps/web/src/features/home/types.ts
index b280dd938c..26aa9187b5 100644
--- a/apps/web/src/features/home/types.ts
+++ b/apps/web/src/features/home/types.ts
@@ -18,7 +18,6 @@ export type HomeTypeFilter =
| 'tasks'
| 'email'
| 'channels'
- | 'chats'
| 'agents'
| 'projects'
| 'github'
diff --git a/apps/web/src/features/home/work-feed/home-scope.ts b/apps/web/src/features/home/work-feed/home-scope.ts
index 3a6ed684a3..66a6bc861e 100644
--- a/apps/web/src/features/home/work-feed/home-scope.ts
+++ b/apps/web/src/features/home/work-feed/home-scope.ts
@@ -8,8 +8,7 @@ const ITEM_TYPES: Record<HomeTypeFilter, WorkFeedItemType[]> = {
tasks: ['document'],
email: ['email'],
channels: ['channel', 'channel_thread'],
- chats: ['chat'],
- agents: ['agent_session'],
+ agents: ['agent_session', 'chat'],
projects: ['project'],
github: ['pull_request'],
calendar: ['calendar_event'],