Fixed new submissions getting added to the downloaded submissions.

This commit is contained in:
Ajay Ramachandran
2019-12-13 21:55:43 -05:00
parent b34e6076e4
commit a5baebab3f
3 changed files with 31 additions and 22 deletions

View File

@@ -1041,6 +1041,9 @@ function submitSponsorTimes() {
//update sponsorTimes
chrome.storage.sync.set({[sponsorTimeKey]: sponsorTimes});
//update sponsorTimesSubmitting
sponsorTimesSubmitting = sponsorTimes;
let confirmMessage = chrome.i18n.getMessage("submitCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes)
+ "\n\n" + chrome.i18n.getMessage("confirmMSG") + "\n\n" + chrome.i18n.getMessage("guildlinesSummary");
if(!confirm(confirmMessage)) return;
@@ -1060,8 +1063,6 @@ function sendSubmitMessage(){
let currentVideoID = sponsorVideoID;
let currentSponsorTimes = submitSponsorTimes;
chrome.runtime.sendMessage({
message: "submitTimes",
videoID: currentVideoID
@@ -1085,11 +1086,19 @@ function sendSubmitMessage(){
//clear the sponsor times
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
chrome.storage.sync.set({[sponsorTimeKey]: []}, () => void updatePreviewBar());
chrome.storage.sync.set({[sponsorTimeKey]: []});
//add submissions to current sponsors list
sponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting);
for (let i = 0; i < sponsorTimesSubmitting.length; i++) {
// Add some random IDs
UUIDs.push(generateUserID());
}
// Empty the submitting times
sponsorTimesSubmitting = [];
updatePreviewBar();
} else {
//show that the upload failed
document.getElementById("submitButton").style.animation = "unset";