X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fvideos%2Fvideo-channels.ts;h=c1065b898b82ede68764a96806848184d10df0f1;hb=3e753302d8c911b59971c16a8018df0e1ab78465;hp=4b26f0bc408c54a0a98b4245a7929e36552a5819;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index 4b26f0bc4..c1065b898 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts @@ -2,8 +2,6 @@ import * as express from 'express' import { body, param } from 'express-validator/check' import { UserRight } from '../../../../shared' import { - doesLocalVideoChannelNameExist, - doesVideoChannelNameWithHostExist, isVideoChannelDescriptionValid, isVideoChannelNameValid, isVideoChannelSupportValid @@ -14,6 +12,8 @@ import { VideoChannelModel } from '../../../models/video/video-channel' import { areValidationErrors } from '../utils' import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor' import { ActorModel } from '../../../models/activitypub/actor' +import { isBooleanValid } from '../../../helpers/custom-validators/misc' +import { doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../../../helpers/middlewares' const videoChannelsAddValidator = [ body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), @@ -40,9 +40,18 @@ const videoChannelsAddValidator = [ const videoChannelsUpdateValidator = [ param('nameWithHost').exists().withMessage('Should have an video channel name with host'), - body('displayName').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), - body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), - body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), + body('displayName') + .optional() + .custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), + body('description') + .optional() + .custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), + body('support') + .optional() + .custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), + body('bulkVideosSupportUpdate') + .optional() + .custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body })