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:
+3
-2
@@ -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 = (
|
||||
|
||||
+2
-4
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user