Revert "Make subdomain minimum length configurable via env var" (#23871)

Instead, reduce the subdomain minimum length to 1 char

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/23871?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Marie
2026-08-07 12:27:00 +02:00
committed by GitHub
parent 47f82b9121
commit 4dbaafc65d
27 changed files with 214 additions and 312 deletions
@@ -41,8 +41,9 @@ describe('getSubdomainSlugFromDisplayName', () => {
expect(getSubdomainSlugFromDisplayName('日本語')).toBe('ri-ben-yu');
});
it('should return undefined when the result is shorter than the minimum length', () => {
expect(getSubdomainSlugFromDisplayName('AB')).toBeUndefined();
it('should accept results as short as a single character', () => {
expect(getSubdomainSlugFromDisplayName('AB')).toBe('ab');
expect(getSubdomainSlugFromDisplayName('A')).toBe('a');
});
it('should clamp long names to the maximum length without a trailing hyphen', () => {
@@ -2,7 +2,7 @@ import { slugify } from 'transliteration';
import { isDefined } from '@/utils/validation/isDefined';
const SUBDOMAIN_MIN_LENGTH = 3;
const SUBDOMAIN_MIN_LENGTH = 1;
const SUBDOMAIN_MAX_LENGTH = 30;
export const getSubdomainSlugFromDisplayName = (
@@ -16,12 +16,10 @@ describe('isValidTwentySubdomain', () => {
expect(isValidTwentySubdomain('a-b-c-d-e')).toBe(true);
});
it('should accept short subdomains regardless of minimum length', () => {
// Minimum length is enforced by the caller, not by the pattern
it('should accept minimum length subdomains (1 character)', () => {
expect(isValidTwentySubdomain('a')).toBe(true);
expect(isValidTwentySubdomain('1')).toBe(true);
expect(isValidTwentySubdomain('ab')).toBe(true);
expect(isValidTwentySubdomain('abc')).toBe(true);
expect(isValidTwentySubdomain('a1b')).toBe(true);
expect(isValidTwentySubdomain('a-b')).toBe(true);
});