diff options
author | Josh Morel <morel.josh@hotmail.com> | 2019-04-02 05:26:47 -0400 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-04-02 11:26:47 +0200 |
commit | 7ccddd7b5250bd25a917a6e77e58b87b9484a2a4 (patch) | |
tree | e75dc991369c1768804fefa114eb2a832881087f /server/middlewares/validators/videos | |
parent | 12fed49ebab0c414713d57ea316b6488ae6bef99 (diff) | |
download | PeerTube-7ccddd7b5250bd25a917a6e77e58b87b9484a2a4.tar.gz PeerTube-7ccddd7b5250bd25a917a6e77e58b87b9484a2a4.tar.zst PeerTube-7ccddd7b5250bd25a917a6e77e58b87b9484a2a4.zip |
add quarantine videos feature (#1637)
* add quarantine videos feature
* increase Notification settings test timeout
to 20000ms. was completing 7000 locally but timing out
after 10000 on travis
* fix quarantine video test issues
-propagate misspelling
-remove skip from server/tests/client.ts
* WIP use blacklist for moderator video approval
instead of video.quarantine boolean
* finish auto-blacklist feature
Diffstat (limited to 'server/middlewares/validators/videos')
-rw-r--r-- | server/middlewares/validators/videos/video-blacklist.ts | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/server/middlewares/validators/videos/video-blacklist.ts b/server/middlewares/validators/videos/video-blacklist.ts index db318dcdb..1d7ddb2e3 100644 --- a/server/middlewares/validators/videos/video-blacklist.ts +++ b/server/middlewares/validators/videos/video-blacklist.ts | |||
@@ -1,10 +1,14 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator/check' | 2 | import { body, param, query } from 'express-validator/check' |
3 | import { isBooleanValid, isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' | 3 | import { isBooleanValid, isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' |
4 | import { doesVideoExist } 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 { doesVideoBlacklistExist, isVideoBlacklistReasonValid } from '../../../helpers/custom-validators/video-blacklist' | 7 | import { |
8 | doesVideoBlacklistExist, | ||
9 | isVideoBlacklistReasonValid, | ||
10 | isVideoBlacklistTypeValid | ||
11 | } from '../../../helpers/custom-validators/video-blacklist' | ||
8 | 12 | ||
9 | const videosBlacklistRemoveValidator = [ | 13 | const videosBlacklistRemoveValidator = [ |
10 | param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), | 14 | param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), |
@@ -65,10 +69,25 @@ const videosBlacklistUpdateValidator = [ | |||
65 | } | 69 | } |
66 | ] | 70 | ] |
67 | 71 | ||
72 | const videosBlacklistFiltersValidator = [ | ||
73 | query('type') | ||
74 | .optional() | ||
75 | .custom(isVideoBlacklistTypeValid).withMessage('Should have a valid video blacklist type attribute'), | ||
76 | |||
77 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
78 | logger.debug('Checking videos blacklist filters query', { parameters: req.query }) | ||
79 | |||
80 | if (areValidationErrors(req, res)) return | ||
81 | |||
82 | return next() | ||
83 | } | ||
84 | ] | ||
85 | |||
68 | // --------------------------------------------------------------------------- | 86 | // --------------------------------------------------------------------------- |
69 | 87 | ||
70 | export { | 88 | export { |
71 | videosBlacklistAddValidator, | 89 | videosBlacklistAddValidator, |
72 | videosBlacklistRemoveValidator, | 90 | videosBlacklistRemoveValidator, |
73 | videosBlacklistUpdateValidator | 91 | videosBlacklistUpdateValidator, |
92 | videosBlacklistFiltersValidator | ||
74 | } | 93 | } |