diff options
Diffstat (limited to 'server/controllers/api/video-playlist.ts')
-rw-r--r-- | server/controllers/api/video-playlist.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 947f7ca77..bcb60e265 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -210,7 +210,6 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) { | |||
210 | 210 | ||
211 | async function updateVideoPlaylist (req: express.Request, res: express.Response) { | 211 | async function updateVideoPlaylist (req: express.Request, res: express.Response) { |
212 | const videoPlaylistInstance = res.locals.videoPlaylistFull | 212 | const videoPlaylistInstance = res.locals.videoPlaylistFull |
213 | const videoPlaylistFieldsSave = videoPlaylistInstance.toJSON() | ||
214 | const videoPlaylistInfoToUpdate = req.body as VideoPlaylistUpdate | 213 | const videoPlaylistInfoToUpdate = req.body as VideoPlaylistUpdate |
215 | 214 | ||
216 | const wasPrivatePlaylist = videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE | 215 | const wasPrivatePlaylist = videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE |
@@ -275,10 +274,9 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response) | |||
275 | } catch (err) { | 274 | } catch (err) { |
276 | logger.debug('Cannot update the video playlist.', { err }) | 275 | logger.debug('Cannot update the video playlist.', { err }) |
277 | 276 | ||
278 | // Force fields we want to update | ||
279 | // If the transaction is retried, sequelize will think the object has not changed | 277 | // If the transaction is retried, sequelize will think the object has not changed |
280 | // So it will skip the SQL request, even if the last one was ROLLBACKed! | 278 | // So we need to restore the previous fields |
281 | resetSequelizeInstance(videoPlaylistInstance, videoPlaylistFieldsSave) | 279 | resetSequelizeInstance(videoPlaylistInstance) |
282 | 280 | ||
283 | throw err | 281 | throw err |
284 | } | 282 | } |