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

move to boolean switch

This commit is contained in:
Rigel Kent 2018-10-12 18:12:39 +02:00
parent 64cc5e8575
commit ed638e5325
No known key found for this signature in database
GPG key ID: EA12971B0E438F36
13 changed files with 47 additions and 58 deletions

View file

@ -1,7 +1,7 @@
import 'express-validator'
import * as validator from 'validator'
import { UserRole } from '../../../shared'
import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES, WEBTORRENT_POLICY_TYPES } from '../../initializers'
import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers'
import { exists, isFileValid, isBooleanValid } from './misc'
import { values } from 'lodash'
@ -42,9 +42,8 @@ function isUserNSFWPolicyValid (value: any) {
return exists(value) && nsfwPolicies.indexOf(value) !== -1
}
const webTorrentPolicies = values(WEBTORRENT_POLICY_TYPES)
function isUserWebTorrentPolicyValid (value: any) {
return exists(value) && webTorrentPolicies.indexOf(value) !== -1
function isUserWebTorrentEnabledValid (value: any) {
return isBooleanValid(value)
}
function isUserAutoPlayVideoValid (value: any) {
@ -83,7 +82,7 @@ export {
isUserUsernameValid,
isUserEmailVerifiedValid,
isUserNSFWPolicyValid,
isUserWebTorrentPolicyValid,
isUserWebTorrentEnabledValid,
isUserAutoPlayVideoValid,
isUserDisplayNameValid,
isUserDescriptionValid,