diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/video-playlist.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index a17136401..62490e63b 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -203,7 +203,9 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response) | |||
203 | const videoPlaylistInstance = res.locals.videoPlaylist | 203 | const videoPlaylistInstance = res.locals.videoPlaylist |
204 | const videoPlaylistFieldsSave = videoPlaylistInstance.toJSON() | 204 | const videoPlaylistFieldsSave = videoPlaylistInstance.toJSON() |
205 | const videoPlaylistInfoToUpdate = req.body as VideoPlaylistUpdate | 205 | const videoPlaylistInfoToUpdate = req.body as VideoPlaylistUpdate |
206 | |||
206 | const wasPrivatePlaylist = videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE | 207 | const wasPrivatePlaylist = videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE |
208 | const wasNotPrivatePlaylist = videoPlaylistInstance.privacy !== VideoPlaylistPrivacy.PRIVATE | ||
207 | 209 | ||
208 | const thumbnailField = req.files['thumbnailfile'] | 210 | const thumbnailField = req.files['thumbnailfile'] |
209 | const thumbnailModel = thumbnailField | 211 | const thumbnailModel = thumbnailField |
@@ -232,6 +234,10 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response) | |||
232 | 234 | ||
233 | if (videoPlaylistInfoToUpdate.privacy !== undefined) { | 235 | if (videoPlaylistInfoToUpdate.privacy !== undefined) { |
234 | videoPlaylistInstance.privacy = parseInt(videoPlaylistInfoToUpdate.privacy.toString(), 10) | 236 | videoPlaylistInstance.privacy = parseInt(videoPlaylistInfoToUpdate.privacy.toString(), 10) |
237 | |||
238 | if (wasNotPrivatePlaylist === true && videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE) { | ||
239 | await sendDeleteVideoPlaylist(videoPlaylistInstance, t) | ||
240 | } | ||
235 | } | 241 | } |
236 | 242 | ||
237 | const playlistUpdated = await videoPlaylistInstance.save(sequelizeOptions) | 243 | const playlistUpdated = await videoPlaylistInstance.save(sequelizeOptions) |