mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Remove the unsubmittedSegments entry when removing the last segment
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
ContentContainer,
|
||||
HashedValue,
|
||||
Keybind,
|
||||
PageType,
|
||||
ScheduledTime,
|
||||
SegmentUUID,
|
||||
SkipToTimeParams,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
ToggleSkippable,
|
||||
VideoID,
|
||||
VideoInfo,
|
||||
PageType
|
||||
} from "./types";
|
||||
import Utils from "./utils";
|
||||
import PreviewBar, { PreviewBarSegment } from "./js-components/previewBar";
|
||||
@@ -1904,11 +1904,15 @@ function isSegmentCreationInProgress(): boolean {
|
||||
|
||||
function cancelCreatingSegment() {
|
||||
if (isSegmentCreationInProgress()) {
|
||||
sponsorTimesSubmitting.splice(sponsorTimesSubmitting.length - 1, 1);
|
||||
if (sponsorTimesSubmitting.length > 1) { // If there's more than one segment: remove last
|
||||
sponsorTimesSubmitting.pop();
|
||||
Config.config.unsubmittedSegments[sponsorVideoID] = sponsorTimesSubmitting;
|
||||
} else { // Otherwise delete the video entry & close submission menu
|
||||
resetSponsorSubmissionNotice();
|
||||
sponsorTimesSubmitting = [];
|
||||
delete Config.config.unsubmittedSegments[sponsorVideoID];
|
||||
}
|
||||
Config.forceSyncUpdate("unsubmittedSegments");
|
||||
|
||||
if (sponsorTimesSubmitting.length <= 0) resetSponsorSubmissionNotice();
|
||||
}
|
||||
|
||||
updateEditButtonsOnPlayer();
|
||||
|
||||
Reference in New Issue
Block a user