From 7529126ca320ccf954f50d8cac5eb07945f94c35 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 21 Jan 2025 17:45:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20support=20custom=20room?= =?UTF-8?q?=20names=20inspired=20by=20Jitsi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Following numerous user requests, add support for personalized room names alongside our existing generated IDs. This pattern, inherited from Jitsi Meet, allows teams to create memorable, persistent meeting spaces like "daily-standup" or "teamalpha" instead of relying only on auto-generated IDs. Note: This change introduces a permanent update to room URL patterns. Once custom room links are shared, we will need to maintain support for both formats to avoid breaking existing shared URLs. --- .../src/features/rooms/utils/isRoomValid.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/rooms/utils/isRoomValid.ts b/src/frontend/src/features/rooms/utils/isRoomValid.ts index a6100d61..592a30d1 100644 --- a/src/frontend/src/features/rooms/utils/isRoomValid.ts +++ b/src/frontend/src/features/rooms/utils/isRoomValid.ts @@ -1,4 +1,22 @@ -export const roomIdPattern = '[a-z]{3}-[a-z]{4}-[a-z]{3}' +/** + * Pattern for system-generated room IDs + * Format: xxx-xxxx-xxx (e.g., abc-defg-hij) + * This pattern is used when rooms are automatically created by the system, + * ensuring consistent and predictable room IDs for randomly generated rooms. + */ +export const generatedRoomPattern = '[a-z]{3}-[a-z]{4}-[a-z]{3}' + +/** + * Pattern for user-defined custom room IDs + * Format: Minimum 5 lowercase alphanumeric characters + * This pattern allows users to create memorable, personalized room names + * while maintaining basic validation rules (e.g., myroom123, teamspace, project2024) + */ +export const personalizedRoomPattern = '[a-z0-9]{5,}' + +// Combined pattern that accepts both system-generated and personalized room IDs +// This allows flexibility in room creation while maintaining consistent validation +export const roomIdPattern = `(?:${generatedRoomPattern}|${personalizedRoomPattern})` export const isRoomValid = (roomIdOrUrl: string) => new RegExp(`^${roomIdPattern}$`).test(roomIdOrUrl) ||