aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-05-31 14:48:03 -0400
committerAjay Ramachandran <[email protected]>2021-05-31 14:48:03 -0400
commit2e1b17f8bdeba7c3242ab8575234f46908e66ad1 (patch)
tree33faef9cc8519605e0978be715faf658ae4677c5
parent9478bfe6a4b17886401ae609ced5e5a95969194c (diff)
downloadSponsorBlock-2e1b17f8bdeba7c3242ab8575234f46908e66ad1.tar.gz
SponsorBlock-2e1b17f8bdeba7c3242ab8575234f46908e66ad1.zip
Refresh segments when creating new segment to submit
-rw-r--r--src/content.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/content.ts b/src/content.ts
index 8154e99e..a9e92f10 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -589,6 +589,7 @@ async function sponsorsLookup(id: string) {
}
}
+ const oldSegments = sponsorTimes;
sponsorTimes = recievedSegments;
// Hide all submissions smaller than the minimum duration
@@ -600,6 +601,15 @@ async function sponsorsLookup(id: string) {
}
}
+ for (const segment of oldSegments) {
+ const otherSegment = sponsorTimes.find((other) => segment.UUID === other.UUID);
+ if (otherSegment) {
+ // If they downvoted it, or changed the category, keep it
+ otherSegment.hidden = segment.hidden;
+ otherSegment.category = segment.category;
+ }
+ }
+
startSkipScheduleCheckingForStartSponsors();
// Reset skip save
@@ -1181,6 +1191,9 @@ function startOrEndTimingNewSegment() {
// Save the newly created segment
Config.config.segmentTimes.set(sponsorVideoID, sponsorTimesSubmitting);
+ // Make sure they know if someone has already submitted something it while they were watching
+ sponsorsLookup(sponsorVideoID);
+
updateEditButtonsOnPlayer();
updateSponsorTimesSubmitting(false);
}