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.

feat(channels): serve channel list via storage client (#3625)

teoeab0f18055f4
diff --git a/js/app/packages/queries/channel/channels.ts b/js/app/packages/queries/channel/channels.ts
index dc9d814314..0d13239e82 100644
--- a/js/app/packages/queries/channel/channels.ts
+++ b/js/app/packages/queries/channel/channels.ts
@@ -1,7 +1,6 @@
import { throwOnErr } from '@core/util/result';
import { queryClient } from '@queries/client';
import { type MutationCallbacks, withCallbacks } from '@queries/utils';
-import { commsServiceClient } from '@service-comms/client';
import { storageServiceClient } from '@service-storage/client';
import type { CreateChannelRequest } from '@service-storage/generated/schemas/createChannelRequest';
import type { CreateChannelResponse } from '@service-storage/generated/schemas/createChannelResponse';
@@ -11,7 +10,7 @@ import { channelKeys } from './keys';
export function useListChannelsQuery() {
return useQuery(() => ({
queryKey: channelKeys.listChannels.queryKey,
- queryFn: async () => await throwOnErr(commsServiceClient.getChannels),
+ queryFn: async () => await throwOnErr(storageServiceClient.getChannels),
}));
}
diff --git a/js/app/packages/service-clients/service-storage/client.ts b/js/app/packages/service-clients/service-storage/client.ts
index 705b521efa..4d2363edf4 100644
--- a/js/app/packages/service-clients/service-storage/client.ts
+++ b/js/app/packages/service-clients/service-storage/client.ts
@@ -24,6 +24,7 @@ import type { ResultError } from '@core/util/result';
import type { SafeFetchInit } from '@core/util/safeFetch';
import type { IDocumentStorageServiceFile } from '@filesystem/file';
+import type { ApiChannelWithLatest } from '@service-comms/generated/models/apiChannelWithLatest';
import { platformFetch } from 'core/util/platformFetch';
import { err, ok, type Result } from 'neverthrow';
import type {
@@ -355,6 +356,17 @@ export const storageServiceClient = {
).map((result) => result);
},
+ // The channel list is still served by the comms hex, mounted at
+ // `/comms/channels` on the same DSS host. Repoint to `/channels` once the
+ // list moves into the channels hex (alongside the comms teardown).
+ async getChannels() {
+ return (
+ await dssFetch<ApiChannelWithLatest[]>(`/comms/channels`, {
+ method: 'GET',
+ })
+ ).map((result) => result);
+ },
+
async getOrCreateDirectMessage(args: GetOrCreateDmRequest) {
const { recipient_id } = args;
return (