From a02d5dc6fc597d521a86c9c9c04ae5c68c9c09e5 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Sat, 27 Apr 2024 04:46:37 +0530 Subject: [PATCH 1/3] Update Regex and titile limit for rooms --- src/CONST.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 8e356be6df29..5fd4ab75df9c 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -843,7 +843,7 @@ const CONST = { }, RESERVED_ROOM_NAMES: ['#admins', '#announce'], MAX_PREVIEW_AVATARS: 4, - MAX_ROOM_NAME_LENGTH: 79, + MAX_ROOM_NAME_LENGTH: 99, LAST_MESSAGE_TEXT_MAX_LENGTH: 200, OWNER_EMAIL_FAKE: '__FAKE__', OWNER_ACCOUNT_ID_FAKE: 0, @@ -1799,7 +1799,7 @@ const CONST = { CARD_NUMBER: /^[0-9]{15,16}$/, CARD_SECURITY_CODE: /^[0-9]{3,4}$/, CARD_EXPIRATION_DATE: /^(0[1-9]|1[0-2])([^0-9])?([0-9]{4}|([0-9]{2}))$/, - ROOM_NAME: /^#[\p{Ll}0-9-]{1,80}$/u, + ROOM_NAME: /^#[\p{Ll}0-9-]{1,100}$/u, // eslint-disable-next-line max-len, no-misleading-character-class EMOJI: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, From 65bf5255e33dd824786e43182b43bbfc118e50e8 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Wed, 1 May 2024 00:21:33 +0530 Subject: [PATCH 2/3] update unit test --- tests/unit/ValidationUtilsTest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/ValidationUtilsTest.ts b/tests/unit/ValidationUtilsTest.ts index a14d71136b22..c92a22791886 100644 --- a/tests/unit/ValidationUtilsTest.ts +++ b/tests/unit/ValidationUtilsTest.ts @@ -241,8 +241,8 @@ describe('ValidationUtils', () => { expect(ValidationUtils.isValidRoomName('#')).toBe(false); }); - test('room name with 81 characters', () => { - expect(ValidationUtils.isValidRoomName('#123456789012345678901234567890123456789012345678901234567890123456789012345678901')).toBe(false); + test('room name with 101 characters', () => { + expect(ValidationUtils.isValidRoomName('#1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890')).toBe(false); }); test('room name with lowercase letters, numbers, and dashes', () => { From 9862f92a014905ec2c8574b8fd3f0b49bd3c33aa Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Wed, 1 May 2024 00:28:29 +0530 Subject: [PATCH 3/3] update unit test --- tests/unit/ValidationUtilsTest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/ValidationUtilsTest.ts b/tests/unit/ValidationUtilsTest.ts index c92a22791886..fc5dacee2cf2 100644 --- a/tests/unit/ValidationUtilsTest.ts +++ b/tests/unit/ValidationUtilsTest.ts @@ -242,7 +242,7 @@ describe('ValidationUtils', () => { }); test('room name with 101 characters', () => { - expect(ValidationUtils.isValidRoomName('#1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890')).toBe(false); + expect(ValidationUtils.isValidRoomName('#12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901')).toBe(false); }); test('room name with lowercase letters, numbers, and dashes', () => {