X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Fmiddlewares%2Fvalidators%2Fvideos%2Fvideo-channels.ts;h=edce48c7f76b4df23dbd1f5e7318b022122455a3;hb=754b6f5f41bdc40aaaeefdb3c351666c305abe20;hp=c4705192a042a403f4a4755a13341b5bd25320b7;hpb=615836dbd4f48fc563551446529fa9d3b14dc329;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index c4705192a..edce48c7f 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts @@ -1,6 +1,5 @@ import express from 'express' import { body, param, query } from 'express-validator' -import { VIDEO_CHANNELS } from '@server/initializers/constants' import { MChannelAccountDefault, MUser } from '@server/types/models' import { UserRight } from '../../../../shared' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' @@ -15,6 +14,7 @@ import { logger } from '../../../helpers/logger' import { ActorModel } from '../../../models/actor/actor' import { VideoChannelModel } from '../../../models/video/video-channel' import { areValidationErrors, doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../shared' +import { CONFIG } from '@server/initializers/config' const videoChannelsAddValidator = [ body('name').custom(isVideoChannelUsernameValid).withMessage('Should have a valid channel name'), @@ -37,8 +37,8 @@ const videoChannelsAddValidator = [ } const count = await VideoChannelModel.countByAccount(res.locals.oauth.token.User.Account.id) - if (count >= VIDEO_CHANNELS.MAX_PER_USER) { - res.fail({ message: `You cannot create more than ${VIDEO_CHANNELS.MAX_PER_USER} channels` }) + if (count >= CONFIG.VIDEO_CHANNELS.MAX_PER_USER) { + res.fail({ message: `You cannot create more than ${CONFIG.VIDEO_CHANNELS.MAX_PER_USER} channels` }) return false }