]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/videos/video-blacklist.ts
Fix big play button
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / videos / video-blacklist.ts
index 808fefc257b6420231f2ecc1da76d5b67cb365d9..7374ba774c1d7271e68cc1124603562fc19ce5e3 100644 (file)
@@ -1,10 +1,10 @@
 import * as express from 'express'
 import { body, param, query } from 'express-validator'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 import { isBooleanValid, isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
 import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist'
 import { logger } from '../../../helpers/logger'
-import { doesVideoBlacklistExist, doesVideoExist } from '../../../helpers/middlewares'
-import { areValidationErrors } from '../utils'
+import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist } from '../shared'
 
 const videosBlacklistRemoveValidator = [
   param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
@@ -38,10 +38,10 @@ const videosBlacklistAddValidator = [
 
     const video = res.locals.videoAll
     if (req.body.unfederate === true && video.remote === true) {
-      return res
-        .status(409)
-        .send({ error: 'You cannot unfederate a remote video.' })
-        .end()
+      return res.fail({
+        status: HttpStatusCode.CONFLICT_409,
+        message: 'You cannot unfederate a remote video.'
+      })
     }
 
     return next()