diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-06 16:44:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-06 16:44:02 +0200 |
commit | 46a6db245f50249246325090eeaffd165453a396 (patch) | |
tree | 7cb829b19c56433270d23f0ac81bed0691293c3e /server/middlewares | |
parent | 60919831276e9c9e9900258bec82b6c31e9e5dd3 (diff) | |
download | PeerTube-46a6db245f50249246325090eeaffd165453a396.tar.gz PeerTube-46a6db245f50249246325090eeaffd165453a396.tar.zst PeerTube-46a6db245f50249246325090eeaffd165453a396.zip |
Add ability to set to private a public/unlisted video
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/videos/videos.ts | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 2b01f108d..b1c05ab2d 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts | |||
@@ -111,18 +111,10 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([ | |||
111 | if (areErrorsInScheduleUpdate(req, res)) return cleanUpReqFiles(req) | 111 | if (areErrorsInScheduleUpdate(req, res)) return cleanUpReqFiles(req) |
112 | if (!await doesVideoExist(req.params.id, res)) return cleanUpReqFiles(req) | 112 | if (!await doesVideoExist(req.params.id, res)) return cleanUpReqFiles(req) |
113 | 113 | ||
114 | const video = res.locals.video | ||
115 | |||
116 | // Check if the user who did the request is able to update the video | 114 | // Check if the user who did the request is able to update the video |
117 | const user = res.locals.oauth.token.User | 115 | const user = res.locals.oauth.token.User |
118 | if (!checkUserCanManageVideo(user, res.locals.video, UserRight.UPDATE_ANY_VIDEO, res)) return cleanUpReqFiles(req) | 116 | if (!checkUserCanManageVideo(user, res.locals.video, UserRight.UPDATE_ANY_VIDEO, res)) return cleanUpReqFiles(req) |
119 | 117 | ||
120 | if (video.privacy !== VideoPrivacy.PRIVATE && req.body.privacy === VideoPrivacy.PRIVATE) { | ||
121 | cleanUpReqFiles(req) | ||
122 | return res.status(409) | ||
123 | .json({ error: 'Cannot set "private" a video that was not private.' }) | ||
124 | } | ||
125 | |||
126 | if (req.body.channelId && !await doesVideoChannelOfAccountExist(req.body.channelId, user, res)) return cleanUpReqFiles(req) | 118 | if (req.body.channelId && !await doesVideoChannelOfAccountExist(req.body.channelId, user, res)) return cleanUpReqFiles(req) |
127 | 119 | ||
128 | return next() | 120 | return next() |