From ae5a3dd6642c8d5abc87b874496026dc9ed37d2d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 19 Mar 2018 10:24:12 +0100 Subject: Update videos response api --- server/helpers/custom-validators/videos.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index a46d715ba..c08ddd24e 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -26,8 +26,12 @@ function isVideoLicenceValid (value: number) { return value === null || VIDEO_LICENCES[value] !== undefined } +function areVideoLanguagesValid (value: number[]) { + return value === null || (isArray(value) && value.every(v => isVideoLanguageValid(v))) +} + function isVideoLanguageValid (value: number) { - return value === null || VIDEO_LANGUAGES[value] !== undefined + return VIDEO_LANGUAGES[value] !== undefined } function isVideoDurationValid (value: string) { @@ -133,6 +137,7 @@ export { isVideoDescriptionValid, isVideoFileInfoHashValid, isVideoNameValid, + areVideoLanguagesValid, isVideoTagsValid, isVideoAbuseReasonValid, isVideoFile, -- cgit v1.2.3