From 2ecf4b3a9ba8c0d7c90dec91f7623ffb29d75d23 Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 12 Sep 2022 10:59:26 -0400 Subject: [PATCH] Fix category votes to use category support to judge when not allowed --- src/routes/voteOnSponsorTime.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index 6205c6b..5b00aac 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -221,8 +221,8 @@ async function categoryVote(UUID: SegmentUUID, userID: UserID, isVIP: boolean, i const segmentInfo = (await db.prepare("get", `SELECT "category", "actionType", "videoID", "hashedVideoID", "service", "userID", "locked" FROM "sponsorTimes" WHERE "UUID" = ?`, [UUID], { useReplica: true })) as {category: Category, actionType: ActionType, videoID: VideoID, hashedVideoID: VideoIDHash, service: Service, userID: UserID, locked: number}; - if (segmentInfo.actionType !== ActionType.Skip || category === "poi_highlight" || category === "chapter") { - return { status: 400, message: "Not allowed to change category of non skip segments" }; + 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}`}; } if (!config.categoryList.includes(category)) { return { status: 400, message: "Category doesn't exist." };