Skip to content

Commit 2ecf4b3

Browse files
committed
Fix category votes to use category support to judge when not allowed
1 parent 94ca291 commit 2ecf4b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/routes/voteOnSponsorTime.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ async function categoryVote(UUID: SegmentUUID, userID: UserID, isVIP: boolean, i
221221
const segmentInfo = (await db.prepare("get", `SELECT "category", "actionType", "videoID", "hashedVideoID", "service", "userID", "locked" FROM "sponsorTimes" WHERE "UUID" = ?`,
222222
[UUID], { useReplica: true })) as {category: Category, actionType: ActionType, videoID: VideoID, hashedVideoID: VideoIDHash, service: Service, userID: UserID, locked: number};
223223

224-
if (segmentInfo.actionType !== ActionType.Skip || category === "poi_highlight" || category === "chapter") {
225-
return { status: 400, message: "Not allowed to change category of non skip segments" };
224+
if (!config.categorySupport[category]?.includes(segmentInfo.actionType) || segmentInfo.actionType === ActionType.Full) {
225+
return { status: 400, message: `Not allowed to change to ${category} when for segment of type ${segmentInfo.actionType}`};
226226
}
227227
if (!config.categoryList.includes(category)) {
228228
return { status: 400, message: "Category doesn't exist." };

0 commit comments

Comments
 (0)