import { MCommentOwnerVideoReply, MVideo, MVideoFullLight } from '../../../types/models/video'
import {
areValidationErrors,
- checkCanSeeVideoIfPrivate,
+ checkCanSeeVideo,
doesVideoCommentExist,
doesVideoCommentThreadExist,
doesVideoExist,
.custom(isBooleanValid)
.withMessage('Should have a valid is local boolean'),
+ query('onLocalVideo')
+ .optional()
+ .customSanitizer(toBooleanOrNull)
+ .custom(isBooleanValid)
+ .withMessage('Should have a valid is on local video boolean'),
+
query('search')
.optional()
.custom(exists).withMessage('Should have a valid search'),
if (areValidationErrors(req, res)) return
if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
- if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.onlyVideo)) return
+ if (!await checkCanSeeVideo({ req, res, paramId: req.params.videoId, video: res.locals.onlyVideo })) return
return next()
}
if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
if (!await doesVideoCommentThreadExist(req.params.threadId, res.locals.onlyVideo, res)) return
- if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.onlyVideo)) return
+ if (!await checkCanSeeVideo({ req, res, paramId: req.params.videoId, video: res.locals.onlyVideo })) return
return next()
}
if (areValidationErrors(req, res)) return
if (!await doesVideoExist(req.params.videoId, res)) return
- if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
+ if (!await checkCanSeeVideo({ req, res, paramId: req.params.videoId, video: res.locals.videoAll })) return
if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) return
if (areValidationErrors(req, res)) return
if (!await doesVideoExist(req.params.videoId, res)) return
- if (!await checkCanSeeVideoIfPrivate(req, res, res.locals.videoAll)) return
+ if (!await checkCanSeeVideo({ req, res, paramId: req.params.videoId, video: res.locals.videoAll })) return
if (!isVideoCommentsEnabled(res.locals.videoAll, res)) return
if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return