1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Reorganize shared models

This commit is contained in:
Chocobozzz 2020-08-06 14:58:01 +02:00 committed by Chocobozzz
parent 583eb04b54
commit bd45d503e5
59 changed files with 155 additions and 144 deletions

View file

@ -1,5 +1,6 @@
import validator from 'validator'
import { AbuseFilter, abusePredefinedReasonsMap, AbusePredefinedReasonsString, AbuseVideoIs, AbuseCreate } from '@shared/models'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbuseCreate, AbuseFilter, AbusePredefinedReasonsString, AbuseVideoIs } from '@shared/models'
import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants'
import { exists, isArray } from './misc'

View file

@ -8,7 +8,8 @@ import { isUrlValid } from './activitypub/misc'
const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS
function isPluginTypeValid (value: any) {
return exists(value) && validator.isInt('' + value) && PluginType[value] !== undefined
return exists(value) &&
(value === PluginType.PLUGIN || value === PluginType.THEME)
}
function isPluginNameValid (value: string) {

View file

@ -10,7 +10,8 @@ function isVideoBlacklistReasonValid (value: string) {
}
function isVideoBlacklistTypeValid (value: any) {
return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined
return exists(value) &&
(value === VideoBlacklistType.AUTO_BEFORE_PUBLISHED || value === VideoBlacklistType.MANUAL)
}
// ---------------------------------------------------------------------------