From 1a717542c77438292104c8e5d7d1e70ff041af4f Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 28 Sep 2021 20:05:48 -0400 Subject: [PATCH] Improve warning message --- public/_locales/en/messages.json | 2 +- src/js-components/chat.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 61fda32d..fa66894f 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -742,7 +742,7 @@ "message": "Hide forever" }, "warningChatInfo": { - "message": "You got a warning and cannot submit segments temporarily. This means that we noticed you were making some common mistakes that are not malicious, and we just want to clarify the rules. You can also join this chat using discord.gg/SponsorBlock or matrix.to/#/#sponsor:ajay.app" + "message": "You got a warning and cannot submit segments temporarily. This means that we noticed you were making some common mistakes that are not malicious, please just confirm that you understand the rules and we will remove the warning. You can also join this chat using discord.gg/SponsorBlock or matrix.to/#/#sponsor:ajay.app" }, "voteRejectedWarning": { "message": "Vote rejected due to a warning. Click to open a chat to resolve it, or come back later when you have time.", diff --git a/src/js-components/chat.ts b/src/js-components/chat.ts index bb7028d2..9ff30af7 100644 --- a/src/js-components/chat.ts +++ b/src/js-components/chat.ts @@ -31,14 +31,16 @@ export function openChat(config: ChatConfig): void { } export async function openWarningChat(warningMessage: string): Promise { + const warningReasonMatch = warningMessage.match(/Warning reason: '(.+)'/); + alert(chrome.i18n.getMessage("warningChatInfo") + `\n\n${warningReasonMatch ? ` Warning reason: ${warningReasonMatch[1]}` : ``}`); + const userNameData = await utils.asyncRequestToServer("GET", "/api/getUsername?userID=" + Config.config.userID); const userName = userNameData.ok ? JSON.parse(userNameData.responseText).userName : ""; const publicUserID = await utils.getHash(Config.config.userID); - const warningReasonMatch = warningMessage.match(/Warning reason: '(.+)'/); openChat({ displayName: `${userName ? userName : ``}${userName !== publicUserID ? ` | ${publicUserID}` : ``}`, - composerInitialValue: `I got a warning and want to know what I need to do to improve.` + + composerInitialValue: `I got a warning and confirm I [REMOVE THIS CAPITAL TEXT TO CONFIRM] reread the guidelines.` + warningReasonMatch ? ` Warning reason: ${warningReasonMatch[1]}` : ``, customDescription: chrome.i18n.getMessage("warningChatInfo") });