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/feeds.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/feeds.ts')
-rw-r--r-- | server/middlewares/validators/feeds.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index f8ebaf6ed..04b4e00c9 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts | |||
@@ -6,6 +6,7 @@ import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helper | |||
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
7 | import { | 7 | import { |
8 | areValidationErrors, | 8 | areValidationErrors, |
9 | checkCanSeeVideo, | ||
9 | doesAccountIdExist, | 10 | doesAccountIdExist, |
10 | doesAccountNameWithHostExist, | 11 | doesAccountNameWithHostExist, |
11 | doesUserFeedTokenCorrespond, | 12 | doesUserFeedTokenCorrespond, |
@@ -112,7 +113,10 @@ const videoCommentsFeedsValidator = [ | |||
112 | return res.fail({ message: 'videoId cannot be mixed with a channel filter' }) | 113 | return res.fail({ message: 'videoId cannot be mixed with a channel filter' }) |
113 | } | 114 | } |
114 | 115 | ||
115 | if (req.query.videoId && !await doesVideoExist(req.query.videoId, res)) return | 116 | if (req.query.videoId) { |
117 | if (!await doesVideoExist(req.query.videoId, res)) return | ||
118 | if (!await checkCanSeeVideo({ req, res, paramId: req.query.videoId, video: res.locals.videoAll })) return | ||
119 | } | ||
116 | 120 | ||
117 | return next() | 121 | return next() |
118 | } | 122 | } |