diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-26 11:52:46 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-26 11:52:52 +0100 |
commit | c06af5012ecc925ca924e6e20db3a1d909b1148e (patch) | |
tree | 88a3595bfd0a68e8f5314737a22f9516d9790c9b /server/middlewares | |
parent | def2a70b7e5ee807d7b532df8c9d33d17d24ccbb (diff) | |
download | PeerTube-c06af5012ecc925ca924e6e20db3a1d909b1148e.tar.gz PeerTube-c06af5012ecc925ca924e6e20db3a1d909b1148e.tar.zst PeerTube-c06af5012ecc925ca924e6e20db3a1d909b1148e.zip |
Add playlist search option and search input for add-to-video-playlist dropdown
fixes #2138
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/videos/video-playlists.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 27ee62b1f..1d67e8666 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts | |||
@@ -166,6 +166,18 @@ const videoPlaylistsGetValidator = (fetchType: VideoPlaylistFetchType) => { | |||
166 | ] | 166 | ] |
167 | } | 167 | } |
168 | 168 | ||
169 | const videoPlaylistsSearchValidator = [ | ||
170 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), | ||
171 | |||
172 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
173 | logger.debug('Checking videoPlaylists search query', { parameters: req.query }) | ||
174 | |||
175 | if (areValidationErrors(req, res)) return | ||
176 | |||
177 | return next() | ||
178 | } | ||
179 | ] | ||
180 | |||
169 | const videoPlaylistsAddVideoValidator = [ | 181 | const videoPlaylistsAddVideoValidator = [ |
170 | param('playlistId') | 182 | param('playlistId') |
171 | .custom(isIdOrUUIDValid).withMessage('Should have a valid playlist id/uuid'), | 183 | .custom(isIdOrUUIDValid).withMessage('Should have a valid playlist id/uuid'), |
@@ -354,6 +366,7 @@ export { | |||
354 | videoPlaylistsUpdateValidator, | 366 | videoPlaylistsUpdateValidator, |
355 | videoPlaylistsDeleteValidator, | 367 | videoPlaylistsDeleteValidator, |
356 | videoPlaylistsGetValidator, | 368 | videoPlaylistsGetValidator, |
369 | videoPlaylistsSearchValidator, | ||
357 | 370 | ||
358 | videoPlaylistsAddVideoValidator, | 371 | videoPlaylistsAddVideoValidator, |
359 | videoPlaylistsUpdateOrRemoveVideoValidator, | 372 | videoPlaylistsUpdateOrRemoveVideoValidator, |