aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/js-components/chat.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/js-components/chat.ts')
-rw-r--r--src/js-components/chat.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js-components/chat.ts b/src/js-components/chat.ts
index 91dc6720..bb7028d2 100644
--- a/src/js-components/chat.ts
+++ b/src/js-components/chat.ts
@@ -34,11 +34,12 @@ export async function openWarningChat(warningMessage: string): Promise<void> {
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. ` +
- `Warning reason: ${warningMessage.match(/Warning reason: '(.+)'/)[1]}`,
+ composerInitialValue: `I got a warning and want to know what I need to do to improve.` +
+ warningReasonMatch ? ` Warning reason: ${warningReasonMatch[1]}` : ``,
customDescription: chrome.i18n.getMessage("warningChatInfo")
});
} \ No newline at end of file