From 31b59b477459d4f26ed8ef089a0e5553fb6a332b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Mar 2017 21:19:46 +0200 Subject: Server: add nsfw attribute --- server/helpers/custom-validators/remote/videos.js | 1 + server/helpers/custom-validators/videos.js | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/remote/videos.js b/server/helpers/custom-validators/remote/videos.js index 9a9055676..df8f8a22e 100644 --- a/server/helpers/custom-validators/remote/videos.js +++ b/server/helpers/custom-validators/remote/videos.js @@ -87,6 +87,7 @@ function isCommonVideoAttributesValid (video) { videosValidators.isVideoDateValid(video.updatedAt) && videosValidators.isVideoCategoryValid(video.category) && videosValidators.isVideoLicenceValid(video.licence) && + videosValidators.isVideoNSFWValid(video.nsfw) && videosValidators.isVideoDescriptionValid(video.description) && videosValidators.isVideoDurationValid(video.duration) && videosValidators.isVideoInfoHashValid(video.infoHash) && diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index 8495e9665..d0b08e7ac 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js @@ -15,6 +15,7 @@ const videosValidators = { isVideoDateValid, isVideoCategoryValid, isVideoLicenceValid, + isVideoNSFWValid, isVideoDescriptionValid, isVideoDurationValid, isVideoInfoHashValid, @@ -50,6 +51,10 @@ function isVideoLicenceValid (value) { return constants.VIDEO_LICENCES[value] !== undefined } +function isVideoNSFWValid (value) { + return validator.isBoolean(value) +} + function isVideoDescriptionValid (value) { return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) } -- cgit v1.2.3