:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(desktop): warn on #general in the space name field (#86813)
Adam Bowkercf3d8d043309
diff --git a/products/desktop/packages/core/src/canvas/channelName.test.ts b/products/desktop/packages/core/src/canvas/channelName.test.tsindex 4d67f9d3c6c1..eb808e610f12 100644--- a/products/desktop/packages/core/src/canvas/channelName.test.ts+++ b/products/desktop/packages/core/src/canvas/channelName.test.ts@@ -123,7 +123,16 @@ describe("validateChannelName", () => {it.each(["personal", "me", " personal "])("reserves %j for the private space",(name) => {- expect(validateChannelName(name)).toContain("reserved");+ expect(validateChannelName(name)).toContain("private space");+ },+ );++ // The API rejects this name too, so accepting it here submits a form that+ // comes back 400 with nothing pointing at the field that caused it.+ it.each(["general", " general "])(+ "reserves %j for the shared space",+ (name) => {+ expect(validateChannelName(name)).toContain("shared space");},);});diff --git a/products/desktop/packages/core/src/canvas/channelName.ts b/products/desktop/packages/core/src/canvas/channelName.tsindex edadeb37f8a4..7061384fcd05 100644--- a/products/desktop/packages/core/src/canvas/channelName.ts+++ b/products/desktop/packages/core/src/canvas/channelName.ts@@ -88,13 +88,13 @@ export function normalizeChannelName(name: string): string {// treated as valid here — callers already gate on a non-empty trimmed value, so// this validator only judges the character set./**- * Names a space can't take, because the private space already answers to them- * and a second space wearing one is a space pretending to be yours.+ * Names a space can't take, because a default space already answers to them and+ * a second space wearing one is a space pretending to be that one.** Client-side only, so it stops the two forms that create and rename spaces —* not the API, and not a space that took the name before this landed.*/-const RESERVED_CHANNEL_NAMES = new Set([+const RESERVED_PERSONAL_NAMES = new Set([PERSONAL_CHANNEL_NAME,PERSONAL_CHANNEL_LABEL,]);@@ -105,8 +105,12 @@ export function validateChannelName(name: string): string | null {if (!CHANNEL_NAME_PATTERN.test(trimmed)) {return "Use only lowercase letters, numbers, and hyphens.";}- if (RESERVED_CHANNEL_NAMES.has(trimmed.toLowerCase())) {+ const lowered = trimmed.toLowerCase();+ if (RESERVED_PERSONAL_NAMES.has(lowered)) {return `"${trimmed}" is reserved for your private space.`;}+ if (normalizeChannelName(lowered) === GENERAL_CHANNEL_NAME) {+ return `"${trimmed}" is reserved for your team's shared space.`;+ }return null;}