diff options
Diffstat (limited to 'server/middlewares/validators/videos/video-comments.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-comments.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts index 91ae31ec2..91e85711d 100644 --- a/server/middlewares/validators/videos/video-comments.ts +++ b/server/middlewares/validators/videos/video-comments.ts | |||
@@ -100,6 +100,14 @@ const addVideoCommentThreadValidator = [ | |||
100 | 100 | ||
101 | if (areValidationErrors(req, res)) return | 101 | if (areValidationErrors(req, res)) return |
102 | if (!await doesVideoExist(req.params.videoId, res)) return | 102 | if (!await doesVideoExist(req.params.videoId, res)) return |
103 | |||
104 | if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) { | ||
105 | return res.fail({ | ||
106 | status: HttpStatusCode.FORBIDDEN_403, | ||
107 | message: 'Cannot access to this ressource' | ||
108 | }) | ||
109 | } | ||
110 | |||
103 | if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return | 111 | if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return |
104 | if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return | 112 | if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return |
105 | 113 | ||
@@ -119,6 +127,14 @@ const addVideoCommentReplyValidator = [ | |||
119 | 127 | ||
120 | if (areValidationErrors(req, res)) return | 128 | if (areValidationErrors(req, res)) return |
121 | if (!await doesVideoExist(req.params.videoId, res)) return | 129 | if (!await doesVideoExist(req.params.videoId, res)) return |
130 | |||
131 | if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) { | ||
132 | return res.fail({ | ||
133 | status: HttpStatusCode.FORBIDDEN_403, | ||
134 | message: 'Cannot access to this ressource' | ||
135 | }) | ||
136 | } | ||
137 | |||
122 | if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return | 138 | if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return |
123 | if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return | 139 | if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return |
124 | if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, true)) return | 140 | if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, true)) return |