Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Room resources: a reference with no link opens nothing, rather than being taken for a package

Simon Flack3b786ea184b7
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-resources-panel.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-resources-panel.tsx
index 51c906aaa..aaa00b7d4 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-resources-panel.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-resources-panel.tsx
@@ -206,7 +206,7 @@ const ResourceSection = observer(function ResourceSection({
: kind === 'documents'
? () => setReading(resource)
: // A package has nothing to read here: its page shows what it holds.
- serverId !== null
+ kind === 'packages' && serverId !== null
? () =>
navigate('libraryItem', {
serverId,
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/room-resources-panel.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/room-resources-panel.test.tsx
index 4d3a4ea2f..feab8aea7 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/room-resources-panel.test.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/room-resources-panel.test.tsx
@@ -279,7 +279,7 @@ describe('the Resources tab', () => {
it('opens a package on its page in Resources when clicked', async () => {
const el = await renderPanel();
await act(async () =>
- [...el.querySelectorAll('[aria-label="Packages"] button')]
+ [...el.querySelectorAll<HTMLButtonElement>('[aria-label="Packages"] button')]
.find((b) => b.textContent?.includes('Onboarding'))!
.click()
);
@@ -289,4 +289,16 @@ describe('the Resources tab', () => {
itemId: 'pkg-1',
});
});
+
+ it('opens nothing for a reference with no link, rather than taking it for a package', async () => {
+ listRoomResources.mockImplementation(async ({ kind }: { kind: keyof typeof RESOURCES }) =>
+ kind === 'references' ? [{ ...RESOURCES.references[0], urls: [] }] : RESOURCES[kind]
+ );
+ const el = await renderPanel();
+ const row = [...el.querySelectorAll('[aria-label="References"] button')].find((b) =>
+ b.textContent?.includes('Repo')
+ );
+ expect(row).toBeUndefined();
+ expect(navigate).not.toHaveBeenCalled();
+ });
});