aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-05 13:54:35 +0200
committerChocobozzz <me@florianbigard.com>2021-08-05 13:54:35 +0200
commit27db78400c558e19bfac0da885fe0b7d0a3e6a0c (patch)
treee50e031f4b0989e438f3c1610c0a16086dd9455f /server/middlewares/validators/videos
parent352819ef921e45381b3fbb17072926103b320e73 (diff)
downloadPeerTube-27db78400c558e19bfac0da885fe0b7d0a3e6a0c.tar.gz
PeerTube-27db78400c558e19bfac0da885fe0b7d0a3e6a0c.tar.zst
PeerTube-27db78400c558e19bfac0da885fe0b7d0a3e6a0c.zip
Fix backend channel name validator consistency
Diffstat (limited to 'server/middlewares/validators/videos')
-rw-r--r--server/middlewares/validators/videos/video-channels.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts
index ea10fe425..3b5693d23 100644
--- a/server/middlewares/validators/videos/video-channels.ts
+++ b/server/middlewares/validators/videos/video-channels.ts
@@ -4,12 +4,12 @@ import { VIDEO_CHANNELS } from '@server/initializers/constants'
4import { MChannelAccountDefault, MUser } from '@server/types/models' 4import { MChannelAccountDefault, MUser } from '@server/types/models'
5import { UserRight } from '../../../../shared' 5import { UserRight } from '../../../../shared'
6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
7import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor'
8import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc' 7import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
9import { 8import {
10 isVideoChannelDescriptionValid, 9 isVideoChannelDescriptionValid,
11 isVideoChannelNameValid, 10 isVideoChannelDisplayNameValid,
12 isVideoChannelSupportValid 11 isVideoChannelSupportValid,
12 isVideoChannelUsernameValid
13} from '../../../helpers/custom-validators/video-channels' 13} from '../../../helpers/custom-validators/video-channels'
14import { logger } from '../../../helpers/logger' 14import { logger } from '../../../helpers/logger'
15import { ActorModel } from '../../../models/actor/actor' 15import { ActorModel } from '../../../models/actor/actor'
@@ -17,8 +17,8 @@ import { VideoChannelModel } from '../../../models/video/video-channel'
17import { areValidationErrors, doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../shared' 17import { areValidationErrors, doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../shared'
18 18
19const videoChannelsAddValidator = [ 19const videoChannelsAddValidator = [
20 body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), 20 body('name').custom(isVideoChannelUsernameValid).withMessage('Should have a valid channel name'),
21 body('displayName').custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), 21 body('displayName').custom(isVideoChannelDisplayNameValid).withMessage('Should have a valid display name'),
22 body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), 22 body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'),
23 body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), 23 body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'),
24 24
@@ -50,7 +50,7 @@ const videoChannelsUpdateValidator = [
50 param('nameWithHost').exists().withMessage('Should have an video channel name with host'), 50 param('nameWithHost').exists().withMessage('Should have an video channel name with host'),
51 body('displayName') 51 body('displayName')
52 .optional() 52 .optional()
53 .custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), 53 .custom(isVideoChannelDisplayNameValid).withMessage('Should have a valid display name'),
54 body('description') 54 body('description')
55 .optional() 55 .optional()
56 .custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), 56 .custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'),
@@ -117,7 +117,7 @@ const videoChannelsNameWithHostValidator = [
117] 117]
118 118
119const localVideoChannelValidator = [ 119const localVideoChannelValidator = [
120 param('name').custom(isVideoChannelNameValid).withMessage('Should have a valid video channel name'), 120 param('name').custom(isVideoChannelDisplayNameValid).withMessage('Should have a valid video channel name'),
121 121
122 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 122 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
123 logger.debug('Checking localVideoChannelValidator parameters', { parameters: req.params }) 123 logger.debug('Checking localVideoChannelValidator parameters', { parameters: req.params })