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.

soup: use channels in post soup query (#981)

Caleb Taylor628c57b9ab36
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx
index e17f9bd200..c2e8f56ada 100644
--- a/js/app/packages/app/component/Soup.tsx
+++ b/js/app/packages/app/component/Soup.tsx
@@ -679,6 +679,9 @@ export function Soup() {
entityQueryClient.invalidateQueries({
queryKey: queryKeys.all.channel,
});
+ entityQueryClient.invalidateQueries({
+ queryKey: queryKeys.all.dss,
+ });
invalidateEntityNotifications(notification.entity_id);
}
);
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index c4ab38a731..7376297a3e 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -46,7 +46,6 @@ import LoadingSpinner from '@icon/regular/spinner.svg?component-solid';
import XIcon from '@icon/regular/x.svg?component-solid';
import { ContextMenu } from '@kobalte/core/context-menu';
import {
- createChannelsQuery,
createDssInfiniteQuery,
createFilterComposer,
createProjectFilterFn,
@@ -988,7 +987,11 @@ export function UnifiedListView(props: UnifiedListViewProps) {
const dssQueryRequestBody = createMemo(
(): PostSoupRequest => ({
channel_filters: {
- channel_ids: [NIL_UUID],
+ channel_ids:
+ entityTypeFilter().includes('channel') ||
+ entityTypeFilter().length === 0
+ ? []
+ : [NIL_UUID],
},
document_filters: {
document_ids:
@@ -1070,17 +1073,10 @@ export function UnifiedListView(props: UnifiedListViewProps) {
return arr.length === 1 && arr[0] === value;
}
- if (onlyHas(typeFilter, 'channel')) return true;
if (isSearchActive() && onlyHas(typeFilter, 'email')) return true;
return false;
});
- const disableChannelsQuery = createMemo(() => {
- const typeFilter = entityTypeFilter();
- if (typeFilter.length > 0 && !typeFilter.includes('channel')) return true;
- return false;
- });
-
// TODO: fix email source
// const emailSource = useGlobalEmailSource();
// createEffect(() => emailSource.setQueryParams(emailQueryParams()));
@@ -1140,9 +1136,6 @@ export function UnifiedListView(props: UnifiedListViewProps) {
UnifiedListComponent,
isLoading,
} = createRoot((dispose) => {
- const channelsQuery = createChannelsQuery({
- disabled: disableChannelsQuery,
- });
const dssInfiniteQuery = createDssInfiniteQuery(
dssQueryParams,
dssQueryRequestBody,
@@ -1189,9 +1182,6 @@ export function UnifiedListView(props: UnifiedListViewProps) {
},
],
entityMapper,
- entityQueries: [
- { query: channelsQuery, operations: { filter: true, search: true } },
- ],
requiredFilter,
optionalFilter,
entitySort,
diff --git a/js/app/packages/macro-entity/src/queries/dss.ts b/js/app/packages/macro-entity/src/queries/dss.ts
index 4268bd4a77..40328e7f32 100644
--- a/js/app/packages/macro-entity/src/queries/dss.ts
+++ b/js/app/packages/macro-entity/src/queries/dss.ts
@@ -282,12 +282,29 @@ const selectData: (
if (item.tag === 'channel') {
const out: ChannelEntity = {
- ...item.data.channel,
- channelType: item.data.channel.channel_type,
type: 'channel',
id: item.data.channel.id,
- name: item.data.channel.name || 'New Channel',
+ name: item.data.channel.name || 'Unknown Channel',
+ channelType: item.data.channel.channel_type,
ownerId: item.data.channel.owner_id,
+ frecencyScore: item.frecency_score ?? 0,
+ updatedAt: Date.parse(item.data.channel.updated_at),
+ createdAt: Date.parse(item.data.channel.created_at),
+ participantIds: item.data.participants.map((p) => p.user_id),
+ viewedAt: item.data.viewed_at
+ ? Date.parse(item.data.viewed_at)
+ : item.data.interacted_at
+ ? Date.parse(item.data.interacted_at)
+ : undefined,
+ latestMessage: item.data.latest_non_thread_message
+ ? {
+ content: item.data.latest_non_thread_message.content,
+ senderId: item.data.latest_non_thread_message.sender_id,
+ createdAt: Date.parse(
+ item.data.latest_non_thread_message.created_at
+ ),
+ }
+ : undefined,
};
return out;
}