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-blacklist.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-blacklist.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-blacklist.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/middlewares/validators/videos/video-blacklist.ts b/server/middlewares/validators/videos/video-blacklist.ts index 2688f63ae..77ad29cbb 100644 --- a/server/middlewares/validators/videos/video-blacklist.ts +++ b/server/middlewares/validators/videos/video-blacklist.ts | |||
@@ -1,10 +1,10 @@ | |||
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 { isBooleanValid, isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' | 3 | import { isBooleanValid, isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' |
4 | import { isVideoExist } from '../../../helpers/custom-validators/videos' | 4 | import { doesVideoExist } from '../../../helpers/custom-validators/videos' |
5 | import { logger } from '../../../helpers/logger' | 5 | import { logger } from '../../../helpers/logger' |
6 | import { areValidationErrors } from '../utils' | 6 | import { areValidationErrors } from '../utils' |
7 | import { isVideoBlacklistExist, isVideoBlacklistReasonValid } from '../../../helpers/custom-validators/video-blacklist' | 7 | import { doesVideoBlacklistExist, isVideoBlacklistReasonValid } from '../../../helpers/custom-validators/video-blacklist' |
8 | import { VideoModel } from '../../../models/video/video' | 8 | import { VideoModel } from '../../../models/video/video' |
9 | 9 | ||
10 | const videosBlacklistRemoveValidator = [ | 10 | const videosBlacklistRemoveValidator = [ |
@@ -14,8 +14,8 @@ const videosBlacklistRemoveValidator = [ | |||
14 | logger.debug('Checking blacklistRemove parameters.', { parameters: req.params }) | 14 | logger.debug('Checking blacklistRemove parameters.', { parameters: req.params }) |
15 | 15 | ||
16 | if (areValidationErrors(req, res)) return | 16 | if (areValidationErrors(req, res)) return |
17 | if (!await isVideoExist(req.params.videoId, res)) return | 17 | if (!await doesVideoExist(req.params.videoId, res)) return |
18 | if (!await isVideoBlacklistExist(res.locals.video.id, res)) return | 18 | if (!await doesVideoBlacklistExist(res.locals.video.id, res)) return |
19 | 19 | ||
20 | return next() | 20 | return next() |
21 | } | 21 | } |
@@ -35,7 +35,7 @@ const videosBlacklistAddValidator = [ | |||
35 | logger.debug('Checking videosBlacklistAdd parameters', { parameters: req.params }) | 35 | logger.debug('Checking videosBlacklistAdd parameters', { parameters: req.params }) |
36 | 36 | ||
37 | if (areValidationErrors(req, res)) return | 37 | if (areValidationErrors(req, res)) return |
38 | if (!await isVideoExist(req.params.videoId, res)) return | 38 | if (!await doesVideoExist(req.params.videoId, res)) return |
39 | 39 | ||
40 | const video: VideoModel = res.locals.video | 40 | const video: VideoModel = res.locals.video |
41 | if (req.body.unfederate === true && video.remote === true) { | 41 | if (req.body.unfederate === true && video.remote === true) { |
@@ -59,8 +59,8 @@ const videosBlacklistUpdateValidator = [ | |||
59 | logger.debug('Checking videosBlacklistUpdate parameters', { parameters: req.params }) | 59 | logger.debug('Checking videosBlacklistUpdate parameters', { parameters: req.params }) |
60 | 60 | ||
61 | if (areValidationErrors(req, res)) return | 61 | if (areValidationErrors(req, res)) return |
62 | if (!await isVideoExist(req.params.videoId, res)) return | 62 | if (!await doesVideoExist(req.params.videoId, res)) return |
63 | if (!await isVideoBlacklistExist(res.locals.video.id, res)) return | 63 | if (!await doesVideoBlacklistExist(res.locals.video.id, res)) return |
64 | 64 | ||
65 | return next() | 65 | return next() |
66 | } | 66 | } |