Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Room settings: Archive and Unarchive, as the gateway says it, and Archive asks first
Simon Flackebdfb0b3bb04
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/archive-room-confirm.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/archive-room-confirm.tsxnew file mode 100644index 000000000..b99932455--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/archive-room-confirm.tsx@@ -0,0 +1,61 @@+import { type ReactNode, useState } from 'react';+import { Button } from '@renderer/lib/ui/button';+import {+ Dialog,+ DialogClose,+ DialogContent,+ DialogContentArea,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@renderer/lib/ui/dialog';++/**+ * Ask before archiving a room: it leaves everyone's room lists, not just+ * yours, so it is worth a second look. Unarchiving puts it back and asks+ * nothing.+ */+export function useArchiveRoomConfirm(): {+ request: (roomName: string, archive: () => void) => void;+ dialog: ReactNode;+} {+ // Kept while the dialog animates closed, so its wording does not empty on the way out.+ const [pending, setPending] = useState<{ roomName: string; archive: () => void } | null>(null);+ const [open, setOpen] = useState(false);++ const request = (roomName: string, archive: () => void) => {+ setPending({ roomName, archive });+ setOpen(true);+ };++ const dialog = (+ <Dialog open={open} onOpenChange={setOpen}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Archive {pending?.roomName ?? 'this room'}?</DialogTitle>+ </DialogHeader>+ <DialogContentArea>+ <DialogDescription>+ It drops out of the room lists, yours and everyone else’s, until someone unarchives it.+ Who is in it, its history and its channel stay as they are.+ </DialogDescription>+ </DialogContentArea>+ <DialogFooter>+ <DialogClose render={<Button variant="outline" size="sm" />}>Cancel</DialogClose>+ <Button+ size="sm"+ onClick={() => {+ setOpen(false);+ pending?.archive();+ }}+ >+ Archive+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );++ return { request, dialog };+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-settings-sections.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-settings-sections.tsxindex 89dad10cd..f597d4bd4 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-settings-sections.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-settings-sections.tsx@@ -26,6 +26,7 @@ import {roomAccessOf,visibilityForAccess,} from '@shared/core/switch-servers/switch-servers';+import { useArchiveRoomConfirm } from './archive-room-confirm';/** The query key the room page reads one room under; shared with `room-configuration-panel`. */function detailKey(workspaceId: string, roomId: string) {@@ -504,6 +505,7 @@ export const ArchiveRoomSection = observer(function ArchiveRoomSection({const queryClient = useQueryClient();const [busy, setBusy] = useState(false);const [error, setError] = useState<string | null>(null);+ const confirmArchive = useArchiveRoomConfirm();if (!permissions.canWrite) return null;async function toggle() {@@ -549,7 +551,9 @@ export const ArchiveRoomSection = observer(function ArchiveRoomSection({size="sm"className="shrink-0"disabled={busy}- onClick={() => void toggle()}+ onClick={() =>+ room.archived ? void toggle() : confirmArchive.request(room.name, () => void toggle())+ }>{room.archived ? <ArchiveRestore className="size-3.5" /> : <Archive className="size-3.5" />}{busy@@ -558,9 +562,9 @@ export const ArchiveRoomSection = observer(function ArchiveRoomSection({: 'Archiving…': room.archived? 'Unarchive'- : // The room is hidden for everyone, not just you.- 'Archive for everyone'}+ : 'Archive'}</Button>+ {confirmArchive.dialog}</div>);});diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/room-settings-sections.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/room-settings-sections.test.tsxindex 7d2e36c00..07e832925 100644--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/room-settings-sections.test.tsx+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/room-settings-sections.test.tsx@@ -223,9 +223,17 @@ describe('room settings for someone who may write to the room', () => {expect(el.textContent).toContain('Nobody holds it right now');});- it('archives the room', async () => {+ it('archives the room once you confirm', async () => {const el = await renderPanel();- await click(button(el, /^Archive for everyone$/)!);+ await click(button(el, /^Archive$/)!);+ // Nothing yet: it asks first, since the room leaves everyone's lists.+ expect(setRoomArchived).not.toHaveBeenCalled();+ const dialog = document.querySelector<HTMLElement>('[role="dialog"]')!;+ expect(dialog.textContent).toContain('everyone else’s');+ const confirm = [...dialog.querySelectorAll('button')].find(+ (b) => b.textContent?.trim() === 'Archive'+ )!;+ await click(confirm);expect(setRoomArchived).toHaveBeenCalledWith({workspaceId: 'ws-1',roomId: 'room-1',@@ -244,7 +252,7 @@ describe('room settings for someone who may only read the room', () => {);expect(el.querySelector('[aria-label="Who can see and change it"]')).toBeNull();expect(button(el, /^Add agent$/)).toBeUndefined();- expect(button(el, /^Archive for everyone$/)).toBeUndefined();+ expect(button(el, /^Archive$/)).toBeUndefined();expect(el.querySelector<HTMLInputElement>('input[aria-label="Name"]')!.disabled).toBe(true);});