diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-05 11:30:43 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | 09979f8959425390b879bce22101a9bc061ae9a0 (patch) | |
tree | a128a50b7c58c070e4b7af44028dfaa03e2d2ef1 /server/middlewares | |
parent | df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa (diff) | |
download | PeerTube-09979f8959425390b879bce22101a9bc061ae9a0.tar.gz PeerTube-09979f8959425390b879bce22101a9bc061ae9a0.tar.zst PeerTube-09979f8959425390b879bce22101a9bc061ae9a0.zip |
Refactor video playlist middlewares
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/videos/video-playlists.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 796c63748..fa26e2336 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts | |||
@@ -45,7 +45,7 @@ const videoPlaylistsUpdateValidator = getCommonPlaylistEditAttributes().concat([ | |||
45 | 45 | ||
46 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) | 46 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) |
47 | 47 | ||
48 | if (!await isVideoPlaylistExist(req.params.playlistId, res)) return cleanUpReqFiles(req) | 48 | if (!await isVideoPlaylistExist(req.params.playlistId, res, 'all')) return cleanUpReqFiles(req) |
49 | 49 | ||
50 | const videoPlaylist = res.locals.videoPlaylist | 50 | const videoPlaylist = res.locals.videoPlaylist |
51 | 51 | ||
@@ -153,7 +153,7 @@ const videoPlaylistsAddVideoValidator = [ | |||
153 | 153 | ||
154 | if (areValidationErrors(req, res)) return | 154 | if (areValidationErrors(req, res)) return |
155 | 155 | ||
156 | if (!await isVideoPlaylistExist(req.params.playlistId, res)) return | 156 | if (!await isVideoPlaylistExist(req.params.playlistId, res, 'all')) return |
157 | if (!await isVideoExist(req.body.videoId, res, 'only-video')) return | 157 | if (!await isVideoExist(req.body.videoId, res, 'only-video')) return |
158 | 158 | ||
159 | const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist | 159 | const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist |
@@ -193,7 +193,7 @@ const videoPlaylistsUpdateOrRemoveVideoValidator = [ | |||
193 | 193 | ||
194 | if (areValidationErrors(req, res)) return | 194 | if (areValidationErrors(req, res)) return |
195 | 195 | ||
196 | if (!await isVideoPlaylistExist(req.params.playlistId, res)) return | 196 | if (!await isVideoPlaylistExist(req.params.playlistId, res, 'all')) return |
197 | if (!await isVideoExist(req.params.videoId, res, 'id')) return | 197 | if (!await isVideoExist(req.params.videoId, res, 'id')) return |
198 | 198 | ||
199 | const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist | 199 | const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist |
@@ -261,7 +261,7 @@ const videoPlaylistsReorderVideosValidator = [ | |||
261 | 261 | ||
262 | if (areValidationErrors(req, res)) return | 262 | if (areValidationErrors(req, res)) return |
263 | 263 | ||
264 | if (!await isVideoPlaylistExist(req.params.playlistId, res)) return | 264 | if (!await isVideoPlaylistExist(req.params.playlistId, res, 'all')) return |
265 | 265 | ||
266 | const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist | 266 | const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist |
267 | if (!checkUserCanManageVideoPlaylist(res.locals.oauth.token.User, videoPlaylist, UserRight.UPDATE_ANY_VIDEO_PLAYLIST, res)) return | 267 | if (!checkUserCanManageVideoPlaylist(res.locals.oauth.token.User, videoPlaylist, UserRight.UPDATE_ANY_VIDEO_PLAYLIST, res)) return |