From 5c10e071dc2845346322130e781509da97c18855 Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 27 May 2024 13:54:02 -0400 Subject: [PATCH] Change how video duration check works for submissions --- src/routes/postSkipSegments.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index 83f8eda..be0f5a6 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -388,9 +388,12 @@ async function updateDataIfVideoDurationChange(videoID: VideoID, service: Servic // Only treat as difference if both the api duration and submitted duration have changed if (videoDurationChanged(videoDuration) && (!videoDurationParam || videoDurationChanged(videoDurationParam))) { // Hide all previous submissions - for (const submission of previousSubmissions) { - await db.prepare("run", `UPDATE "sponsorTimes" SET "hidden" = 1 WHERE "UUID" = ?`, [submission.UUID]); - } + await db.prepare("run", `UPDATE "sponsorTimes" SET "hidden" = 1 + WHERE "videoID" = ? AND "service" = ? AND "videoDuration" != ? + AND "hidden" = 0 AND "shadowHidden" = 0 AND + "actionType" != 'full' AND "votes" > -2`, + [videoID, service, videoDuration]); + lockedCategoryList = []; deleteLockCategories(videoID, null, null, service).catch((e) => Logger.error(`deleting lock categories: ${e}`)); }