check caps-lock with regexp because string.toUpper == string does also return true for foreign characters like mandarin

This commit is contained in:
HF 2020-04-28 06:24:44 +02:00
parent d756da6a1c
commit c231cbf8f1

View File

@ -16,6 +16,7 @@ class ChatProvider {
constructor() {
this.history = [];
this.caseCheck = /^[A-Z !.]*$/;
this.filters = [
{
regexp: /ADMIN/gi,
@ -64,7 +65,7 @@ class ChatProvider {
return 'Your mail has to be verified in order to chat';
}
if (message === message.toUpperCase()) {
if (message.match(this.caseCheck)) {
return 'Stop shouting';
}