Limit mute action type to specific categories

This commit is contained in:
Ajay Ramachandran
2021-09-04 00:33:37 -04:00
parent 6f29b807c5
commit 1823a91d54
3 changed files with 41 additions and 2 deletions

View File

@@ -348,8 +348,8 @@ function checkInvalidFields(videoID: any, userID: any, segments: Array<any>): Ch
return CHECK_PASS;
}
async function checkEachSegmentValid(userID: string, videoID: VideoID
, segments: Array<any>, service: string, isVIP: boolean, lockedCategoryList: Array<any>): Promise<CheckResult> {
async function checkEachSegmentValid(userID: string, videoID: VideoID,
segments: Array<any>, service: string, isVIP: boolean, lockedCategoryList: Array<any>): Promise<CheckResult> {
for (let i = 0; i < segments.length; i++) {
if (segments[i] === undefined || segments[i].segment === undefined || segments[i].category === undefined) {
@@ -379,6 +379,10 @@ async function checkEachSegmentValid(userID: string, videoID: VideoID
};
}
if (!config.categorySupport[segments[i].category]?.includes(segments[i].actionType)) {
return { pass: false, errorMessage: "ActionType is not supported with this category.", errorCode: 400 };
}
const startTime = parseFloat(segments[i].segment[0]);
const endTime = parseFloat(segments[i].segment[1]);