aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/video-blacklist.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/video-blacklist.ts')
-rw-r--r--server/middlewares/validators/video-blacklist.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/server/middlewares/validators/video-blacklist.ts b/server/middlewares/validators/video-blacklist.ts
index f1cc04950..98099fe3f 100644
--- a/server/middlewares/validators/video-blacklist.ts
+++ b/server/middlewares/validators/video-blacklist.ts
@@ -1,9 +1,10 @@
1import * as express from 'express' 1import * as express from 'express'
2import { param } from 'express-validator/check' 2import { param } from 'express-validator/check'
3import { isIdOrUUIDValid, logger } from '../../helpers' 3import { logger } from '../../helpers'
4import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
4import { isVideoExist } from '../../helpers/custom-validators/videos' 5import { isVideoExist } from '../../helpers/custom-validators/videos'
5import { database as db } from '../../initializers/database' 6import { VideoModel } from '../../models/video/video'
6import { VideoInstance } from '../../models/video/video-interface' 7import { VideoBlacklistModel } from '../../models/video/video-blacklist'
7import { areValidationErrors } from './utils' 8import { areValidationErrors } from './utils'
8 9
9const videosBlacklistRemoveValidator = [ 10const videosBlacklistRemoveValidator = [
@@ -42,7 +43,7 @@ export {
42} 43}
43// --------------------------------------------------------------------------- 44// ---------------------------------------------------------------------------
44 45
45function checkVideoIsBlacklistable (video: VideoInstance, res: express.Response) { 46function checkVideoIsBlacklistable (video: VideoModel, res: express.Response) {
46 if (video.isOwned() === true) { 47 if (video.isOwned() === true) {
47 res.status(403) 48 res.status(403)
48 .json({ error: 'Cannot blacklist a local video' }) 49 .json({ error: 'Cannot blacklist a local video' })
@@ -54,8 +55,8 @@ function checkVideoIsBlacklistable (video: VideoInstance, res: express.Response)
54 return true 55 return true
55} 56}
56 57
57async function checkVideoIsBlacklisted (video: VideoInstance, res: express.Response) { 58async function checkVideoIsBlacklisted (video: VideoModel, res: express.Response) {
58 const blacklistedVideo = await db.BlacklistedVideo.loadByVideoId(video.id) 59 const blacklistedVideo = await VideoBlacklistModel.loadByVideoId(video.id)
59 if (!blacklistedVideo) { 60 if (!blacklistedVideo) {
60 res.status(404) 61 res.status(404)
61 .send('Blacklisted video not found') 62 .send('Blacklisted video not found')