Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(community): make private category copy fixed and drop admin-visibility claim

Gener4c2d7d95c1ab
diff --git a/src/web/src/components/community/create-category-dialog.tsx b/src/web/src/components/community/create-category-dialog.tsx
index 4c68775d2..71efa2412 100644
--- a/src/web/src/components/community/create-category-dialog.tsx
+++ b/src/web/src/components/community/create-category-dialog.tsx
@@ -10,8 +10,8 @@ import { PrivateCategoryRow } from "./private-category-row"
// Create Category dialog — name + private toggle (defaults to public). In a
// private category any member can create a channel, but each channel is visible
-// only to its creator + invited members (and admins). A public category's
-// channels are admin-managed and visible to everyone.
+// only to its creator + invited members — admins get no visibility bypass. A
+// public category's channels are visible to everyone.
export function CreateCategoryDialog({ onClose, onCreate, canTogglePrivate = true }: {
onClose: () => void
onCreate: (name: string, opts: { private: boolean }) => void
diff --git a/src/web/src/components/community/private-category-row.test.ts b/src/web/src/components/community/private-category-row.test.ts
index ed2f6f9e5..9a27dbadc 100644
--- a/src/web/src/components/community/private-category-row.test.ts
+++ b/src/web/src/components/community/private-category-row.test.ts
@@ -4,8 +4,7 @@ import { renderToStaticMarkup } from "react-dom/server"
import { PrivateCategoryRow } from "./private-category-row"
import {
PRIVATE_CATEGORY_LABEL,
- PRIVATE_CATEGORY_DESC_PRIVATE,
- PRIVATE_CATEGORY_DESC_PUBLIC,
+ PRIVATE_CATEGORY_DESC,
PRIVATE_CATEGORY_LOCKED_SUFFIX,
} from "@/lib/community/category-copy"
@@ -17,16 +16,9 @@ describe("PrivateCategoryRow", () => {
expect(render({ isPrivate: false })).toContain(PRIVATE_CATEGORY_LABEL)
})
- it("shows the public copy when not private", () => {
- const html = render({ isPrivate: false, onToggle: vi.fn() })
- expect(html).toContain(PRIVATE_CATEGORY_DESC_PUBLIC)
- expect(html).not.toContain(PRIVATE_CATEGORY_DESC_PRIVATE)
- })
-
- it("shows the private copy when private", () => {
- const html = render({ isPrivate: true, onToggle: vi.fn() })
- expect(html).toContain(PRIVATE_CATEGORY_DESC_PRIVATE)
- expect(html).not.toContain(PRIVATE_CATEGORY_DESC_PUBLIC)
+ it("shows the fixed description regardless of toggle state", () => {
+ expect(render({ isPrivate: false, onToggle: vi.fn() })).toContain(PRIVATE_CATEGORY_DESC)
+ expect(render({ isPrivate: true, onToggle: vi.fn() })).toContain(PRIVATE_CATEGORY_DESC)
})
it("renders a Switch when onToggle is provided", () => {
@@ -36,16 +28,17 @@ describe("PrivateCategoryRow", () => {
it("hides the Switch and appends the locked suffix in read-only mode", () => {
const html = render({ isPrivate: true, locked: true })
expect(html).not.toContain('data-slot="switch"')
- expect(html).toContain(PRIVATE_CATEGORY_DESC_PRIVATE)
+ expect(html).toContain(PRIVATE_CATEGORY_DESC)
expect(html).toContain(PRIVATE_CATEGORY_LOCKED_SUFFIX)
})
- it("draws its copy from the shared constants (same private string both dialogs use)", () => {
- expect(PRIVATE_CATEGORY_DESC_PRIVATE).toBe(
- "Members create their own channels here, visible only to invited members.",
- )
- expect(PRIVATE_CATEGORY_DESC_PUBLIC).toBe(
- "Channels here are admin-managed and visible to everyone.",
+ it("does not claim admins can see private channels", () => {
+ expect(PRIVATE_CATEGORY_DESC.toLowerCase()).not.toContain("admin")
+ })
+
+ it("draws its copy from the shared constant", () => {
+ expect(PRIVATE_CATEGORY_DESC).toBe(
+ "Making a category private limits it to invited members. Each stays visible only to its creator and invited members.",
)
})
})
diff --git a/src/web/src/components/community/private-category-row.tsx b/src/web/src/components/community/private-category-row.tsx
index c6d4509b7..08f3ebac4 100644
--- a/src/web/src/components/community/private-category-row.tsx
+++ b/src/web/src/components/community/private-category-row.tsx
@@ -4,8 +4,7 @@ import { Lock } from "lucide-react"
import { Switch } from "@/components/ui/switch"
import {
PRIVATE_CATEGORY_LABEL,
- PRIVATE_CATEGORY_DESC_PRIVATE,
- PRIVATE_CATEGORY_DESC_PUBLIC,
+ PRIVATE_CATEGORY_DESC,
PRIVATE_CATEGORY_LOCKED_SUFFIX,
} from "@/lib/community/category-copy"
@@ -14,11 +13,9 @@ export function PrivateCategoryRow({ isPrivate, onToggle, locked }: {
onToggle?: (v: boolean) => void
locked?: boolean
}) {
- const description = isPrivate
- ? locked
- ? `${PRIVATE_CATEGORY_DESC_PRIVATE} ${PRIVATE_CATEGORY_LOCKED_SUFFIX}`
- : PRIVATE_CATEGORY_DESC_PRIVATE
- : PRIVATE_CATEGORY_DESC_PUBLIC
+ const description = locked
+ ? `${PRIVATE_CATEGORY_DESC} ${PRIVATE_CATEGORY_LOCKED_SUFFIX}`
+ : PRIVATE_CATEGORY_DESC
return (
<div className="flex items-start gap-3 rounded-md border border-border bg-card px-3 py-2">
<Lock className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
diff --git a/src/web/src/lib/community/category-copy.ts b/src/web/src/lib/community/category-copy.ts
index d8ab99a98..da0d52971 100644
--- a/src/web/src/lib/community/category-copy.ts
+++ b/src/web/src/lib/community/category-copy.ts
@@ -1,10 +1,7 @@
export const PRIVATE_CATEGORY_LABEL = "Private category"
-export const PRIVATE_CATEGORY_DESC_PRIVATE =
- "Members create their own channels here, visible only to invited members."
-
-export const PRIVATE_CATEGORY_DESC_PUBLIC =
- "Channels here are admin-managed and visible to everyone."
+export const PRIVATE_CATEGORY_DESC =
+ "Making a category private limits it to invited members. Each stays visible only to its creator and invited members."
export const PRIVATE_CATEGORY_LOCKED_SUFFIX =
"Privacy can’t be changed after creation."