Add basic chat box when getting a warning

This commit is contained in:
Ajay Ramachandran
2021-07-29 18:16:44 -04:00
parent 1656fae2d4
commit 1a855a6993
6 changed files with 63 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ import SkipNotice from "./render/SkipNotice";
import SkipNoticeComponent from "./components/SkipNoticeComponent";
import SubmissionNotice from "./render/SubmissionNotice";
import { Message, MessageResponse } from "./messageTypes";
import GenericNotice from "./render/GenericNotice";
import * as Chat from "./js-components/chat";
// Hack to get the CSS loaded on permission-based sites (Invidious)
utils.wait(() => Config.config !== null, 5000, 10).then(addCSS);
@@ -1567,7 +1567,11 @@ async function sendSubmitMessage() {
playerButtons.submit.button.style.animation = "unset";
playerButtons.submit.image.src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker.svg");
alert(utils.getErrorMessage(response.status, response.responseText));
if (response.status === 403 && response.responseText.startsWith("Submission rejected due to a warning from a moderator.")) {
Chat.openWarningChat(response.responseText);
} else {
alert(utils.getErrorMessage(response.status, response.responseText));
}
}
}