diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-03-28 21:19:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-03-28 21:19:46 +0200 |
commit | 31b59b477459d4f26ed8ef089a0e5553fb6a332b (patch) | |
tree | 70de15dc172045d01ad45718f55c22d5ca43b354 /server/helpers/custom-validators | |
parent | d07137b90b2b2b0c1e93a6f0e7bf8719b133027c (diff) | |
download | PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.tar.gz PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.tar.zst PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.zip |
Server: add nsfw attribute
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/remote/videos.js | 1 | ||||
-rw-r--r-- | server/helpers/custom-validators/videos.js | 5 |
2 files changed, 6 insertions, 0 deletions
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) { | |||
87 | videosValidators.isVideoDateValid(video.updatedAt) && | 87 | videosValidators.isVideoDateValid(video.updatedAt) && |
88 | videosValidators.isVideoCategoryValid(video.category) && | 88 | videosValidators.isVideoCategoryValid(video.category) && |
89 | videosValidators.isVideoLicenceValid(video.licence) && | 89 | videosValidators.isVideoLicenceValid(video.licence) && |
90 | videosValidators.isVideoNSFWValid(video.nsfw) && | ||
90 | videosValidators.isVideoDescriptionValid(video.description) && | 91 | videosValidators.isVideoDescriptionValid(video.description) && |
91 | videosValidators.isVideoDurationValid(video.duration) && | 92 | videosValidators.isVideoDurationValid(video.duration) && |
92 | videosValidators.isVideoInfoHashValid(video.infoHash) && | 93 | 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 = { | |||
15 | isVideoDateValid, | 15 | isVideoDateValid, |
16 | isVideoCategoryValid, | 16 | isVideoCategoryValid, |
17 | isVideoLicenceValid, | 17 | isVideoLicenceValid, |
18 | isVideoNSFWValid, | ||
18 | isVideoDescriptionValid, | 19 | isVideoDescriptionValid, |
19 | isVideoDurationValid, | 20 | isVideoDurationValid, |
20 | isVideoInfoHashValid, | 21 | isVideoInfoHashValid, |
@@ -50,6 +51,10 @@ function isVideoLicenceValid (value) { | |||
50 | return constants.VIDEO_LICENCES[value] !== undefined | 51 | return constants.VIDEO_LICENCES[value] !== undefined |
51 | } | 52 | } |
52 | 53 | ||
54 | function isVideoNSFWValid (value) { | ||
55 | return validator.isBoolean(value) | ||
56 | } | ||
57 | |||
53 | function isVideoDescriptionValid (value) { | 58 | function isVideoDescriptionValid (value) { |
54 | return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) | 59 | return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) |
55 | } | 60 | } |