]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/videos.ts
Federate entire description
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / videos.ts
index ca5f70fdc2e8574dc52c7a5207afc14fe039eb74..9e8177f77a58f001eb4dcb529285fe58695a49ae 100644 (file)
@@ -1,5 +1,4 @@
 import { UploadFilesForCheck } from 'express'
-import { values } from 'lodash'
 import magnetUtil from 'magnet-uri'
 import validator from 'validator'
 import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models'
@@ -46,10 +45,6 @@ function isVideoDurationValid (value: string) {
   return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION)
 }
 
-function isVideoTruncatedDescriptionValid (value: string) {
-  return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.TRUNCATED_DESCRIPTION)
-}
-
 function isVideoDescriptionValid (value: string) {
   return value === null || (exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION))
 }
@@ -78,8 +73,9 @@ function isVideoViewsValid (value: string) {
   return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS)
 }
 
+const ratingTypes = new Set(Object.values(VIDEO_RATE_TYPES))
 function isVideoRatingTypeValid (value: string) {
-  return value === 'none' || values(VIDEO_RATE_TYPES).includes(value as VideoRateType)
+  return value === 'none' || ratingTypes.has(value as VideoRateType)
 }
 
 function isVideoFileExtnameValid (value: string) {
@@ -151,7 +147,6 @@ export {
   isVideoCategoryValid,
   isVideoLicenceValid,
   isVideoLanguageValid,
-  isVideoTruncatedDescriptionValid,
   isVideoDescriptionValid,
   isVideoFileInfoHashValid,
   isVideoNameValid,