From 1becebdcd5565db9e3ba8fff1b5d444ab26c7ec6 Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Sat, 8 Oct 2022 09:04:37 +0200 Subject: [PATCH 1/3] Actually pass the ignoreCache param, as the comment suggests --- src/routes/voteOnSponsorTime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index 97b7c5c..bba06fb 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -59,7 +59,7 @@ async function updateSegmentVideoDuration(UUID: SegmentUUID) { let apiVideoDetails: videoDetails = null; if (service == Service.YouTube) { // don't use cache since we have no information about the video length - apiVideoDetails = await getVideoDetails(videoID); + apiVideoDetails = await getVideoDetails(videoID, true); } const apiVideoDuration = apiVideoDetails?.duration as VideoDuration; if (videoDurationChanged(videoDuration, apiVideoDuration)) { From d229003f6e61d5ef1cb882ed73483bc1c8fbff04 Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Sat, 8 Oct 2022 09:08:40 +0200 Subject: [PATCH 2/3] Unlock the video on duration change detected when voting --- src/routes/voteOnSponsorTime.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index bba06fb..1f8c619 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -14,6 +14,7 @@ import { DBSegment, Category, HashedIP, IPAddress, SegmentUUID, Service, VideoID import { QueryCacher } from "../utils/queryCacher"; import axios from "axios"; import { getVideoDetails, videoDetails } from "../utils/getVideoDetails"; +import { deleteLockCategories } from "./deleteLockCategories"; const voteTypes = { normal: 0, @@ -95,6 +96,7 @@ async function checkVideoDuration(UUID: SegmentUUID) { AND "hidden" = 0 AND "shadowHidden" = 0 AND "actionType" != 'full' AND "votes" > -2`, [videoID, service, latestSubmission.timeSubmitted]); + deleteLockCategories(videoID, null, null, service).catch(Logger.error); } } From ceaf9ec6f629127b19613eb3a1b926a187da8eb7 Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Sat, 8 Oct 2022 09:09:19 +0200 Subject: [PATCH 3/3] Fix linter warning --- src/routes/voteOnSponsorTime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index 1f8c619..bbda1e2 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -221,7 +221,7 @@ async function categoryVote(UUID: SegmentUUID, userID: UserID, isVIP: boolean, i [UUID], { useReplica: true })) as {category: Category, actionType: ActionType, videoID: VideoID, hashedVideoID: VideoIDHash, service: Service, userID: UserID, locked: number}; if (!config.categorySupport[category]?.includes(segmentInfo.actionType) || segmentInfo.actionType === ActionType.Full) { - return { status: 400, message: `Not allowed to change to ${category} when for segment of type ${segmentInfo.actionType}`}; + return { status: 400, message: `Not allowed to change to ${category} when for segment of type ${segmentInfo.actionType}` }; } if (!config.categoryList.includes(category)) { return { status: 400, message: "Category doesn't exist." };