Remove unnecessary code
This commit is contained in:
parent
95faf1eaff
commit
f1c70a8666
2 changed files with 3 additions and 18 deletions
|
@ -91,12 +91,7 @@ const addVideoCommentThreadValidator = [
|
||||||
if (areValidationErrors(req, res)) return
|
if (areValidationErrors(req, res)) return
|
||||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||||
|
|
||||||
if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) {
|
if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
|
||||||
return res.fail({
|
|
||||||
status: HttpStatusCode.FORBIDDEN_403,
|
|
||||||
message: 'Cannot access to this ressource'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
|
if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
|
||||||
if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return
|
if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return
|
||||||
|
@ -118,12 +113,7 @@ const addVideoCommentReplyValidator = [
|
||||||
if (areValidationErrors(req, res)) return
|
if (areValidationErrors(req, res)) return
|
||||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||||
|
|
||||||
if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) {
|
if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
|
||||||
return res.fail({
|
|
||||||
status: HttpStatusCode.FORBIDDEN_403,
|
|
||||||
message: 'Cannot access to this ressource'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
|
if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
|
||||||
if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return
|
if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return
|
||||||
|
|
|
@ -21,12 +21,7 @@ const videoUpdateRateValidator = [
|
||||||
if (areValidationErrors(req, res)) return
|
if (areValidationErrors(req, res)) return
|
||||||
if (!await doesVideoExist(req.params.id, res)) return
|
if (!await doesVideoExist(req.params.id, res)) return
|
||||||
|
|
||||||
if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) {
|
if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
|
||||||
return res.fail({
|
|
||||||
status: HttpStatusCode.FORBIDDEN_403,
|
|
||||||
message: 'Cannot access to this ressource'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue