Skip to content

Commit eb3d733

Browse files
authored
Merge pull request #510 from mini-bomba/misc-fixes
Some fixes for voteOnSponsorTime.ts
2 parents 9386f25 + ceaf9ec commit eb3d733

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/routes/voteOnSponsorTime.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { DBSegment, Category, HashedIP, IPAddress, SegmentUUID, Service, VideoID
1414
import { QueryCacher } from "../utils/queryCacher";
1515
import axios from "axios";
1616
import { getVideoDetails, videoDetails } from "../utils/getVideoDetails";
17+
import { deleteLockCategories } from "./deleteLockCategories";
1718

1819
const voteTypes = {
1920
normal: 0,
@@ -59,7 +60,7 @@ async function updateSegmentVideoDuration(UUID: SegmentUUID) {
5960
let apiVideoDetails: videoDetails = null;
6061
if (service == Service.YouTube) {
6162
// don't use cache since we have no information about the video length
62-
apiVideoDetails = await getVideoDetails(videoID);
63+
apiVideoDetails = await getVideoDetails(videoID, true);
6364
}
6465
const apiVideoDuration = apiVideoDetails?.duration as VideoDuration;
6566
if (videoDurationChanged(videoDuration, apiVideoDuration)) {
@@ -95,6 +96,7 @@ async function checkVideoDuration(UUID: SegmentUUID) {
9596
AND "hidden" = 0 AND "shadowHidden" = 0 AND
9697
"actionType" != 'full' AND "votes" > -2`,
9798
[videoID, service, latestSubmission.timeSubmitted]);
99+
deleteLockCategories(videoID, null, null, service).catch(Logger.error);
98100
}
99101
}
100102

@@ -219,7 +221,7 @@ async function categoryVote(UUID: SegmentUUID, userID: UserID, isVIP: boolean, i
219221
[UUID], { useReplica: true })) as {category: Category, actionType: ActionType, videoID: VideoID, hashedVideoID: VideoIDHash, service: Service, userID: UserID, locked: number};
220222

221223
if (!config.categorySupport[category]?.includes(segmentInfo.actionType) || segmentInfo.actionType === ActionType.Full) {
222-
return { status: 400, message: `Not allowed to change to ${category} when for segment of type ${segmentInfo.actionType}`};
224+
return { status: 400, message: `Not allowed to change to ${category} when for segment of type ${segmentInfo.actionType}` };
223225
}
224226
if (!config.categoryList.includes(category)) {
225227
return { status: 400, message: "Category doesn't exist." };

0 commit comments

Comments
 (0)