deal with some cyrillic characters in en channel

This commit is contained in:
HF 2020-05-16 20:38:02 +02:00
parent 3b2cb0bb15
commit a2405e349b

View File

@ -21,6 +21,7 @@ export class ChatProvider {
this.history.push([]); this.history.push([]);
} }
this.caseCheck = /^[A-Z !.]*$/; this.caseCheck = /^[A-Z !.]*$/;
this.cyrillic = new RegExp('[\u0436-\u043B]');
this.filters = [ this.filters = [
{ {
regexp: /ADMIN/gi, regexp: /ADMIN/gi,
@ -63,7 +64,6 @@ export class ChatProvider {
? 'il' ? 'il'
: country; : country;
if (name.toUpperCase().startsWith('POP')) return null;
if (!name) { if (!name) {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
return 'Couldn\'t send your message, pls log out and back in again.'; return 'Couldn\'t send your message, pls log out and back in again.';
@ -79,6 +79,10 @@ export class ChatProvider {
return 'Stop shouting'; return 'Stop shouting';
} }
if (message.match(this.cyrillic) && channelId === 0) {
return 'Please use int channel';
}
for (let i = 0; i < this.filters.length; i += 1) { for (let i = 0; i < this.filters.length; i += 1) {
const filter = this.filters[i]; const filter = this.filters[i];
const count = (message.match(filter.regexp) || []).length; const count = (message.match(filter.regexp) || []).length;