From fd45e8f43c2638478599ca75632518054461da85 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 31 Oct 2017 11:52:52 +0100 Subject: Add video privacy setting --- server/helpers/custom-validators/videos.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 5b9102275..f3fdcaf2d 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -11,6 +11,7 @@ import { VIDEO_LICENCES, VIDEO_LANGUAGES, VIDEO_RATE_TYPES, + VIDEO_PRIVACIES, database as db } from '../../initializers' import { isUserUsernameValid } from './users' @@ -36,6 +37,15 @@ function isVideoLicenceValid (value: number) { return VIDEO_LICENCES[value] !== undefined } +function isVideoPrivacyValid (value: string) { + return VIDEO_PRIVACIES[value] !== undefined +} + +// Maybe we don't know the remote privacy setting, but that doesn't matter +function isRemoteVideoPrivacyValid (value: string) { + return validator.isInt('' + value) +} + // Maybe we don't know the remote licence, but that doesn't matter function isRemoteVideoLicenceValid (value: string) { return validator.isInt('' + value) @@ -195,6 +205,8 @@ export { isVideoDislikesValid, isVideoEventCountValid, isVideoFileSizeValid, + isVideoPrivacyValid, + isRemoteVideoPrivacyValid, isVideoFileResolutionValid, checkVideoExists, isRemoteVideoCategoryValid, -- cgit v1.2.3