diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-03-24 01:12:30 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-03-31 10:29:24 +0200 |
commit | 747c562837e37f2fa455e8ef62165e9bb4e365f1 (patch) | |
tree | ae7628afb2865de93b195b064df1dace2e524dbe /server/middlewares | |
parent | 8165d00ac6263cf3c0d61d450960ef36635084ff (diff) | |
download | PeerTube-747c562837e37f2fa455e8ef62165e9bb4e365f1.tar.gz PeerTube-747c562837e37f2fa455e8ef62165e9bb4e365f1.tar.zst PeerTube-747c562837e37f2fa455e8ef62165e9bb4e365f1.zip |
Put channel stats behind withStats flag
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/videos/video-channels.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index ebce14714..882fb2b84 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
3 | import { UserRight } from '../../../../shared' | 3 | import { UserRight } from '../../../../shared' |
4 | import { | 4 | import { |
5 | isVideoChannelDescriptionValid, | 5 | isVideoChannelDescriptionValid, |
@@ -128,6 +128,15 @@ const localVideoChannelValidator = [ | |||
128 | } | 128 | } |
129 | ] | 129 | ] |
130 | 130 | ||
131 | const videoChannelStatsValidator = [ | ||
132 | query('withStats').optional().isBoolean().withMessage('Should have a valid stats flag'), | ||
133 | |||
134 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
135 | if (areValidationErrors(req, res)) return | ||
136 | return next() | ||
137 | } | ||
138 | ] | ||
139 | |||
131 | // --------------------------------------------------------------------------- | 140 | // --------------------------------------------------------------------------- |
132 | 141 | ||
133 | export { | 142 | export { |
@@ -135,7 +144,8 @@ export { | |||
135 | videoChannelsUpdateValidator, | 144 | videoChannelsUpdateValidator, |
136 | videoChannelsRemoveValidator, | 145 | videoChannelsRemoveValidator, |
137 | videoChannelsNameWithHostValidator, | 146 | videoChannelsNameWithHostValidator, |
138 | localVideoChannelValidator | 147 | localVideoChannelValidator, |
148 | videoChannelStatsValidator | ||
139 | } | 149 | } |
140 | 150 | ||
141 | // --------------------------------------------------------------------------- | 151 | // --------------------------------------------------------------------------- |