X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fusers.ts;h=80652b4798eb566f2606da590e681f74c581abc7;hb=28f3d1b36a70426795240c9370e47b6c4ba847f8;hp=2024d4a22d9afff26ffa0fec09f96acac010fb49;hpb=64cc5e8575fda47b281ae20abf0020e27fc8ce7c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 2024d4a22..80652b479 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -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,12 @@ 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 isUserVideosHistoryEnabledValid (value: any) { + return isBooleanValid(value) } function isUserAutoPlayVideoValid (value: any) { @@ -74,6 +77,7 @@ function isAvatarFile (files: { [ fieldname: string ]: Express.Multer.File[] } | // --------------------------------------------------------------------------- export { + isUserVideosHistoryEnabledValid, isUserBlockedValid, isUserPasswordValid, isUserBlockedReasonValid, @@ -83,7 +87,7 @@ export { isUserUsernameValid, isUserEmailVerifiedValid, isUserNSFWPolicyValid, - isUserWebTorrentPolicyValid, + isUserWebTorrentEnabledValid, isUserAutoPlayVideoValid, isUserDisplayNameValid, isUserDescriptionValid,