X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fvideo-channels.ts;h=92c0de419eec0256a5862a22c4ada653543080ac;hb=fd4484f19eae8b0a0c30d5d30e98880c8708516a;hp=fe42105e871f35b84169b8b54834a4c6e0ff34eb;hpb=2422c46b27790d94fd29a7092170cee5a1b56008;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts index fe42105e8..92c0de419 100644 --- a/server/middlewares/validators/video-channels.ts +++ b/server/middlewares/validators/video-channels.ts @@ -4,8 +4,10 @@ import { UserRight } from '../../../shared' import { isAccountIdExist } from '../../helpers/custom-validators/accounts' import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' import { - isVideoChannelDescriptionValid, isVideoChannelExist, - isVideoChannelNameValid, isVideoChannelSupportValid + isVideoChannelDescriptionValid, + isVideoChannelExist, + isVideoChannelNameValid, + isVideoChannelSupportValid } from '../../helpers/custom-validators/video-channels' import { logger } from '../../helpers/logger' import { UserModel } from '../../models/account/user' @@ -26,7 +28,7 @@ const listVideoAccountChannelsValidator = [ ] const videoChannelsAddValidator = [ - body('name').custom(isVideoChannelNameValid).withMessage('Should have a valid name'), + body('displayName').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'), @@ -41,7 +43,7 @@ const videoChannelsAddValidator = [ const videoChannelsUpdateValidator = [ param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), - body('name').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid name'), + 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'), @@ -77,7 +79,6 @@ const videoChannelsRemoveValidator = [ if (areValidationErrors(req, res)) return if (!await isVideoChannelExist(req.params.id, res)) return - // Check if the user who did the request is able to delete the video if (!checkUserCanDeleteVideoChannel(res.locals.oauth.token.User, res.locals.videoChannel, res)) return if (!await checkVideoChannelIsNotTheLastOne(res)) return @@ -92,6 +93,7 @@ const videoChannelsGetValidator = [ logger.debug('Checking videoChannelsGet parameters', { parameters: req.params }) if (areValidationErrors(req, res)) return + if (!await isVideoChannelExist(req.params.id, res)) return return next()