diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-22 09:44:08 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-22 10:25:31 +0200 |
commit | ff9d43f62a4f4737c5bfe955883b48c5440f323a (patch) | |
tree | 60593f4b57ec5cd712986a3db370f39b0b7a4cef /server/middlewares/validators/videos/video-rates.ts | |
parent | 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 (diff) | |
download | PeerTube-ff9d43f62a4f4737c5bfe955883b48c5440f323a.tar.gz PeerTube-ff9d43f62a4f4737c5bfe955883b48c5440f323a.tar.zst PeerTube-ff9d43f62a4f4737c5bfe955883b48c5440f323a.zip |
Refactor video rights checker
Diffstat (limited to 'server/middlewares/validators/videos/video-rates.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-rates.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts index 1a9736034..8b8eeedb6 100644 --- a/server/middlewares/validators/videos/video-rates.ts +++ b/server/middlewares/validators/videos/video-rates.ts | |||
@@ -8,7 +8,7 @@ import { isRatingValid } from '../../../helpers/custom-validators/video-rates' | |||
8 | import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' | 8 | import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' |
9 | import { logger } from '../../../helpers/logger' | 9 | import { logger } from '../../../helpers/logger' |
10 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 10 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
11 | import { areValidationErrors, checkCanSeeVideoIfPrivate, doesVideoExist, isValidVideoIdParam } from '../shared' | 11 | import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam } from '../shared' |
12 | 12 | ||
13 | const videoUpdateRateValidator = [ | 13 | const videoUpdateRateValidator = [ |
14 | isValidVideoIdParam('id'), | 14 | isValidVideoIdParam('id'), |
@@ -21,7 +21,7 @@ const videoUpdateRateValidator = [ | |||
21 | if (areValidationErrors(req, res)) return | 21 | if (areValidationErrors(req, res)) return |
22 | if (!await doesVideoExist(req.params.id, res)) return | 22 | if (!await doesVideoExist(req.params.id, res)) return |
23 | 23 | ||
24 | if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return | 24 | if (!await checkCanSeeVideo({ req, res, paramId: req.params.id, video: res.locals.videoAll })) return |
25 | 25 | ||
26 | return next() | 26 | return next() |
27 | } | 27 | } |