]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Don't check enum for video model
authorChocobozzz <me@florianbigard.com>
Tue, 29 Jun 2021 14:21:32 +0000 (16:21 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 29 Jun 2021 14:21:32 +0000 (16:21 +0200)
Licence, language and category could be extended by a remote plugin

server/models/video/video.ts

index d2efc255316d593f69b4fc05a9d3570d586d8965..2b40225dd233d560933c17bd53c003072acc63c9 100644 (file)
@@ -43,11 +43,8 @@ import { peertubeTruncate } from '../../helpers/core-utils'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
 import { isBooleanValid } from '../../helpers/custom-validators/misc'
 import {
-  isVideoCategoryValid,
   isVideoDescriptionValid,
   isVideoDurationValid,
-  isVideoLanguageValid,
-  isVideoLicenceValid,
   isVideoNameValid,
   isVideoPrivacyValid,
   isVideoStateValid,
@@ -458,19 +455,16 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
 
   @AllowNull(true)
   @Default(null)
-  @Is('VideoCategory', value => throwIfNotValid(value, isVideoCategoryValid, 'category', true))
   @Column
   category: number
 
   @AllowNull(true)
   @Default(null)
-  @Is('VideoLicence', value => throwIfNotValid(value, isVideoLicenceValid, 'licence', true))
   @Column
   licence: number
 
   @AllowNull(true)
   @Default(null)
-  @Is('VideoLanguage', value => throwIfNotValid(value, isVideoLanguageValid, 'language', true))
   @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.LANGUAGE.max))
   language: string