diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 09:26:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 09:26:50 +0100 |
commit | 0f6acda11681de90d38dd18669863c6e270851ee (patch) | |
tree | b3b28e00d539645f5a810202dc8afada289e7b2e /server/middlewares/validators/videos/video-channels.ts | |
parent | 9a18a6252071cf21b18f82a24bb63078abb75bc1 (diff) | |
download | PeerTube-0f6acda11681de90d38dd18669863c6e270851ee.tar.gz PeerTube-0f6acda11681de90d38dd18669863c6e270851ee.tar.zst PeerTube-0f6acda11681de90d38dd18669863c6e270851ee.zip |
Does exist
Diffstat (limited to 'server/middlewares/validators/videos/video-channels.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-channels.ts | 14 |
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 c2763ce51..e2067c4d9 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator/check' | 2 | import { body, param } from 'express-validator/check' |
3 | import { UserRight } from '../../../../shared' | 3 | import { UserRight } from '../../../../shared' |
4 | import { isAccountNameWithHostExist } from '../../../helpers/custom-validators/accounts' | 4 | import { doesAccountNameWithHostExist } from '../../../helpers/custom-validators/accounts' |
5 | import { | 5 | import { |
6 | isLocalVideoChannelNameExist, | 6 | doesLocalVideoChannelNameExist, |
7 | isVideoChannelDescriptionValid, | 7 | isVideoChannelDescriptionValid, |
8 | isVideoChannelNameValid, | 8 | isVideoChannelNameValid, |
9 | isVideoChannelNameWithHostExist, | 9 | doesVideoChannelNameWithHostExist, |
10 | isVideoChannelSupportValid | 10 | isVideoChannelSupportValid |
11 | } from '../../../helpers/custom-validators/video-channels' | 11 | } from '../../../helpers/custom-validators/video-channels' |
12 | import { logger } from '../../../helpers/logger' | 12 | import { logger } from '../../../helpers/logger' |
@@ -49,7 +49,7 @@ const videoChannelsUpdateValidator = [ | |||
49 | logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body }) | 49 | logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body }) |
50 | 50 | ||
51 | if (areValidationErrors(req, res)) return | 51 | if (areValidationErrors(req, res)) return |
52 | if (!await isVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return | 52 | if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return |
53 | 53 | ||
54 | // We need to make additional checks | 54 | // We need to make additional checks |
55 | if (res.locals.videoChannel.Actor.isOwned() === false) { | 55 | if (res.locals.videoChannel.Actor.isOwned() === false) { |
@@ -75,7 +75,7 @@ const videoChannelsRemoveValidator = [ | |||
75 | logger.debug('Checking videoChannelsRemove parameters', { parameters: req.params }) | 75 | logger.debug('Checking videoChannelsRemove parameters', { parameters: req.params }) |
76 | 76 | ||
77 | if (areValidationErrors(req, res)) return | 77 | if (areValidationErrors(req, res)) return |
78 | if (!await isVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return | 78 | if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return |
79 | 79 | ||
80 | if (!checkUserCanDeleteVideoChannel(res.locals.oauth.token.User, res.locals.videoChannel, res)) return | 80 | if (!checkUserCanDeleteVideoChannel(res.locals.oauth.token.User, res.locals.videoChannel, res)) return |
81 | if (!await checkVideoChannelIsNotTheLastOne(res)) return | 81 | if (!await checkVideoChannelIsNotTheLastOne(res)) return |
@@ -92,7 +92,7 @@ const videoChannelsNameWithHostValidator = [ | |||
92 | 92 | ||
93 | if (areValidationErrors(req, res)) return | 93 | if (areValidationErrors(req, res)) return |
94 | 94 | ||
95 | if (!await isVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return | 95 | if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return |
96 | 96 | ||
97 | return next() | 97 | return next() |
98 | } | 98 | } |
@@ -105,7 +105,7 @@ const localVideoChannelValidator = [ | |||
105 | logger.debug('Checking localVideoChannelValidator parameters', { parameters: req.params }) | 105 | logger.debug('Checking localVideoChannelValidator parameters', { parameters: req.params }) |
106 | 106 | ||
107 | if (areValidationErrors(req, res)) return | 107 | if (areValidationErrors(req, res)) return |
108 | if (!await isLocalVideoChannelNameExist(req.params.name, res)) return | 108 | if (!await doesLocalVideoChannelNameExist(req.params.name, res)) return |
109 | 109 | ||
110 | return next() | 110 | return next() |
111 | } | 111 | } |