Skip to content

Commit e3c0b92

Browse files
committed
updates per feedbacks
1 parent 2d2e9b4 commit e3c0b92

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

frontend/model/contracts/shared/functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export const validateChatRoomName = (name: string) => {
203203
const nameValidationMap: {[string]: Function} = {
204204
[L('Chatroom name cannot contain white-space')]: (v: string): boolean => /\s/.test(v),
205205
[L('Chatroom name cannot contain capital letters')]: (v: string): boolean => /\p{Lu}/u.test(v),
206-
[L('Chatroom name cannot contain punctuations or special characters except hyphen')]: (v: string): boolean => /[^\p{L}\p{N}-]/gu.test(v)
206+
[L('Chatroom name cannot contain punctuation or special characters except hyphen')]: (v: string): boolean => /[^\p{L}\p{Nd}-]/u.test(v)
207207
}
208208

209209
for (const key in nameValidationMap) {

frontend/views/containers/chatroom/CreateNewChannelModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@blur='updateField("name")'
2525
v-error:name=''
2626
)
27-
i18n.helper.with-icon(v-if='!$v.form.name.$error' tag='p') Channel name can't contain white spaces, special characters, capital letters or punctuations.
27+
i18n.helper.with-icon(v-if='!$v.form.name.$error' tag='p') Channel name can't contain whitespace, special characters, capital letters or punctuation.
2828

2929
label.field
3030
.c-desc-label-container

frontend/views/containers/chatroom/EditChannelNameModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
data-test='updateChannelName'
2525
)
2626

27-
i18n.helper.with-icon(v-if='!$v.form.name.$error' tag='p') Channel name can't contain white spaces, special characters, capital letters or punctuations.
27+
i18n.helper.with-icon(v-if='!$v.form.name.$error' tag='p') Channel name can't contain whitespace, special characters, capital letters or punctuation.
2828

2929
banner-scoped(ref='formMsg')
3030

frontend/views/utils/filters.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ export const filterByKeyword = (
7979
}
8080

8181
export const sanitizeChannelName = (name: string): string => {
82-
return name.replace(/\s/g, '-') // Replace all whitespaces with '-'
82+
return name.replace(/\s/g, '-') // Replace all whitespace with '-'
8383
.toLowerCase() // Convert to lowercase
8484
/*
8585
The regex below removes everything except:
8686
\p{L} - Any letter from any language
87-
\p{N} - Any kind of numeric character
87+
\p{Nd} - Any digit numbers
8888
'-' - The hyphen (separator)
8989
9090
Reference: Unicode character class escape -
9191
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape
9292
*/
93-
.replace(/[^\p{L}\p{N}-]/gu, '')
93+
.replace(/[^\p{L}\p{Nd}-]/gu, '')
9494
}

0 commit comments

Comments
 (0)