From 493b0106acfe86f29db4076f8a3811f882594819 Mon Sep 17 00:00:00 2001 From: HF Date: Tue, 3 Nov 2020 23:52:20 +0100 Subject: [PATCH] allow multiple blank lines in eslint, check for muted user earlier --- .eslintrc.json | 1 + src/core/ChatProvider.js | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 279c9c71..8b769b3f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,6 +31,7 @@ "react/jsx-closing-tag-location":"off", "jsx-a11y/click-events-have-key-events":"off", "no-continue": "off", + "no-multiple-empty-lines": "off", "lines-between-class-members":["warn", "always",{"exceptAfterSingleLine": true}] } } diff --git a/src/core/ChatProvider.js b/src/core/ChatProvider.js index 7bb5dd00..ad1801d0 100644 --- a/src/core/ChatProvider.js +++ b/src/core/ChatProvider.js @@ -82,6 +82,18 @@ export class ChatProvider { return 'Stop shouting'; } + const muted = await ChatProvider.checkIfMuted(user); + if (muted === -1) { + return 'You are permanently muted, join our guilded to apppeal the mute'; + } + if (muted > 0) { + if (muted > 120) { + const timeMin = Math.round(muted / 60); + return `You are muted for another ${timeMin} minutes`; + } + return `You are muted for another ${muted} seconds`; + } + for (let i = 0; i < this.filters.length; i += 1) { const filter = this.filters[i]; const count = (message.match(filter.regexp) || []).length; @@ -154,17 +166,6 @@ export class ChatProvider { return 'Your country is temporary muted from chat'; } - const muted = await ChatProvider.checkIfMuted(user); - if (muted === -1) { - return 'You are permanently muted, join our discord to apppeal the mute'; - } - if (muted > 0) { - if (muted > 120) { - const timeMin = Math.round(muted / 60); - return `You are muted for another ${timeMin} minutes`; - } - return `You are muted for another ${muted} seconds`; - } this.addMessage(name, message, displayCountry, channelId); webSockets.broadcastChatMessage(name, message, displayCountry, channelId); return null;