From 2cebd797014561ebc0bfee07ee8b5d83820adb66 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Jul 2018 10:45:10 +0200 Subject: Fix last commit --- server/helpers/custom-validators/videos.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/helpers/custom-validators/videos.ts') diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 70904af0c..338c96582 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -110,7 +110,7 @@ function isScheduleVideoUpdatePrivacyValid (value: number) { ) } -function isVideoFileInfoHashValid (value: string) { +function isVideoFileInfoHashValid (value: string | null | undefined) { return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH) } @@ -158,7 +158,7 @@ async function isVideoExist (id: string, res: Response) { video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(id) } - if (video && video !== null) { + if (video === null) { res.status(404) .json({ error: 'Video not found' }) .end() @@ -173,7 +173,7 @@ async function isVideoExist (id: string, res: Response) { async function isVideoChannelOfAccountExist (channelId: number, user: UserModel, res: Response) { if (user.hasRight(UserRight.UPDATE_ANY_VIDEO) === true) { const videoChannel = await VideoChannelModel.loadAndPopulateAccount(channelId) - if (videoChannel && videoChannel !== null) { + if (videoChannel === null) { res.status(400) .json({ error: 'Unknown video video channel on this instance.' }) .end() @@ -186,7 +186,7 @@ async function isVideoChannelOfAccountExist (channelId: number, user: UserModel, } const videoChannel = await VideoChannelModel.loadByIdAndAccount(channelId, user.Account.id) - if (videoChannel && videoChannel !== null) { + if (videoChannel === null) { res.status(400) .json({ error: 'Unknown video video channel for this account.' }) .end() -- cgit v1.2.3