]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/blacklist.ts
Fix video comments display with deleted comments
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / blacklist.ts
index 2c6948923d8d652b3f0002b53a7d13b038447a78..fa8448c864a1976c69cad3168303e4a5ad079fa6 100644 (file)
@@ -18,19 +18,20 @@ import {
   videosBlacklistUpdateValidator
 } from '../../../middlewares'
 import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const blacklistRouter = express.Router()
 
 blacklistRouter.post('/:videoId/blacklist',
   authenticate,
-  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS),
+  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
   asyncMiddleware(videosBlacklistAddValidator),
   asyncMiddleware(addVideoToBlacklistController)
 )
 
 blacklistRouter.get('/blacklist',
   authenticate,
-  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS),
+  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
   paginationValidator,
   blacklistSortValidator,
   setBlacklistSort,
@@ -41,14 +42,14 @@ blacklistRouter.get('/blacklist',
 
 blacklistRouter.put('/:videoId/blacklist',
   authenticate,
-  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS),
+  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
   asyncMiddleware(videosBlacklistUpdateValidator),
   asyncMiddleware(updateVideoBlacklistController)
 )
 
 blacklistRouter.delete('/:videoId/blacklist',
   authenticate,
-  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS),
+  ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
   asyncMiddleware(videosBlacklistRemoveValidator),
   asyncMiddleware(removeVideoFromBlacklistController)
 )
@@ -69,7 +70,7 @@ async function addVideoToBlacklistController (req: express.Request, res: express
 
   logger.info('Video %s blacklisted.', videoInstance.uuid)
 
-  return res.type('json').sendStatus(204)
+  return res.type('json').sendStatus(HttpStatusCode.NO_CONTENT_204)
 }
 
 async function updateVideoBlacklistController (req: express.Request, res: express.Response) {
@@ -81,7 +82,7 @@ async function updateVideoBlacklistController (req: express.Request, res: expres
     return videoBlacklist.save({ transaction: t })
   })
 
-  return res.type('json').sendStatus(204)
+  return res.type('json').sendStatus(HttpStatusCode.NO_CONTENT_204)
 }
 
 async function listBlacklist (req: express.Request, res: express.Response) {
@@ -104,5 +105,5 @@ async function removeVideoFromBlacklistController (req: express.Request, res: ex
 
   logger.info('Video %s removed from blacklist.', video.uuid)
 
-  return res.type('json').sendStatus(204)
+  return res.type('json').sendStatus(HttpStatusCode.NO_CONTENT_204)
 }