]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/videos/video-shares.ts
Allow users/visitors to search through an account's videos (#3589)
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / videos / video-shares.ts
index d5cbdb03ef2ae64eccfdc821f6d844e4bbc03a79..f0d8e0c360529712ffb6ae8daf868e0a544938d0 100644 (file)
@@ -1,11 +1,11 @@
 import * as express from 'express'
-import 'express-validator'
-import { param } from 'express-validator/check'
+import { param } from 'express-validator'
 import { isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc'
-import { doesVideoExist } from '../../../helpers/custom-validators/videos'
 import { logger } from '../../../helpers/logger'
 import { VideoShareModel } from '../../../models/video/video-share'
 import { areValidationErrors } from '../utils'
+import { doesVideoExist } from '../../../helpers/middlewares'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const videosShareValidator = [
   param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
@@ -17,11 +17,11 @@ const videosShareValidator = [
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
-    const video = res.locals.video
+    const video = res.locals.videoAll
 
     const share = await VideoShareModel.load(req.params.actorId, video.id)
     if (!share) {
-      return res.status(404)
+      return res.status(HttpStatusCode.NOT_FOUND_404)
                 .end()
     }