aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-28 16:04:31 +0100
committerChocobozzz <me@florianbigard.com>2022-02-28 16:04:31 +0100
commitf1c70a8666e53414f4e604290d35d26ae725b691 (patch)
tree5109eb7c2a572096f2057bd458a9e370bd0f9d26
parent95faf1eafffff4fe1f74025092c7c3eef2951697 (diff)
downloadPeerTube-f1c70a8666e53414f4e604290d35d26ae725b691.tar.gz
PeerTube-f1c70a8666e53414f4e604290d35d26ae725b691.tar.zst
PeerTube-f1c70a8666e53414f4e604290d35d26ae725b691.zip
Remove unnecessary code
-rw-r--r--server/middlewares/validators/videos/video-comments.ts14
-rw-r--r--server/middlewares/validators/videos/video-rates.ts7
2 files changed, 3 insertions, 18 deletions
diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts
index 96d956035..698afdbd1 100644
--- a/server/middlewares/validators/videos/video-comments.ts
+++ b/server/middlewares/validators/videos/video-comments.ts
@@ -91,12 +91,7 @@ const addVideoCommentThreadValidator = [
91 if (areValidationErrors(req, res)) return 91 if (areValidationErrors(req, res)) return
92 if (!await doesVideoExist(req.params.videoId, res)) return 92 if (!await doesVideoExist(req.params.videoId, res)) return
93 93
94 if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) { 94 if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
95 return res.fail({
96 status: HttpStatusCode.FORBIDDEN_403,
97 message: 'Cannot access to this ressource'
98 })
99 }
100 95
101 if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return 96 if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
102 if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return 97 if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return
@@ -118,12 +113,7 @@ const addVideoCommentReplyValidator = [
118 if (areValidationErrors(req, res)) return 113 if (areValidationErrors(req, res)) return
119 if (!await doesVideoExist(req.params.videoId, res)) return 114 if (!await doesVideoExist(req.params.videoId, res)) return
120 115
121 if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) { 116 if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
122 return res.fail({
123 status: HttpStatusCode.FORBIDDEN_403,
124 message: 'Cannot access to this ressource'
125 })
126 }
127 117
128 if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return 118 if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
129 if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return 119 if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts
index 923bf3eaf..1a9736034 100644
--- a/server/middlewares/validators/videos/video-rates.ts
+++ b/server/middlewares/validators/videos/video-rates.ts
@@ -21,12 +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)) { 24 if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
25 return res.fail({
26 status: HttpStatusCode.FORBIDDEN_403,
27 message: 'Cannot access to this ressource'
28 })
29 }
30 25
31 return next() 26 return next()
32 } 27 }