From 6200d8d91710b03a72a27e35cbe6eed1e6cc8c62 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 May 2018 11:33:11 +0200 Subject: Fix video channel update with an admin account --- server/middlewares/validators/videos.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/middlewares/validators/videos.ts') diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index dd0246a63..c5c45fe58 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts @@ -90,7 +90,7 @@ const videosAddValidator = [ const videoFile: Express.Multer.File = req.files['videofile'][0] const user = res.locals.oauth.token.User - if (!await isVideoChannelOfAccountExist(req.body.channelId, user.Account.id, res)) return + if (!await isVideoChannelOfAccountExist(req.body.channelId, user, res)) return const isAble = await user.isAbleToUploadVideo(videoFile) if (isAble === false) { @@ -193,7 +193,7 @@ const videosUpdateValidator = [ .end() } - if (req.body.channelId && !await isVideoChannelOfAccountExist(req.body.channelId, user.Account.id, res)) return + if (req.body.channelId && !await isVideoChannelOfAccountExist(req.body.channelId, user, res)) return return next() } @@ -332,7 +332,7 @@ function checkUserCanManageVideo (user: UserModel, video: VideoModel, right: Use // Retrieve the user who did the request if (video.isOwned() === false) { res.status(403) - .json({ error: 'Cannot remove video of another server, blacklist it' }) + .json({ error: 'Cannot manage a video of another server.' }) .end() return false } @@ -343,7 +343,7 @@ function checkUserCanManageVideo (user: UserModel, video: VideoModel, right: Use const account = video.VideoChannel.Account if (user.hasRight(right) === false && account.userId !== user.id) { res.status(403) - .json({ error: 'Cannot remove video of another user' }) + .json({ error: 'Cannot manage a video of another user.' }) .end() return false } -- cgit v1.2.3