check caps-lock with regexp because string.toUpper == string does also return true for foreign characters like mandarin
This commit is contained in:
parent
d756da6a1c
commit
c231cbf8f1
|
@ -16,6 +16,7 @@ class ChatProvider {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.history = [];
|
this.history = [];
|
||||||
|
this.caseCheck = /^[A-Z !.]*$/;
|
||||||
this.filters = [
|
this.filters = [
|
||||||
{
|
{
|
||||||
regexp: /ADMIN/gi,
|
regexp: /ADMIN/gi,
|
||||||
|
@ -64,7 +65,7 @@ class ChatProvider {
|
||||||
return 'Your mail has to be verified in order to chat';
|
return 'Your mail has to be verified in order to chat';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message === message.toUpperCase()) {
|
if (message.match(this.caseCheck)) {
|
||||||
return 'Stop shouting';
|
return 'Stop shouting';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user