]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/video-playlist.ts
Add Podcast RSS feeds (#5487)
[github/Chocobozzz/PeerTube.git] / server / controllers / api / video-playlist.ts
index 947f7ca7787de463948e9b48a311c3b2adb57489..de32dec88d2a26015d8f11d2f1e0b0cc441cb303 100644 (file)
@@ -139,7 +139,7 @@ async function listVideoPlaylists (req: express.Request, res: express.Response)
     start: req.query.start,
     count: req.query.count,
     sort: req.query.sort,
-    type: req.query.type
+    type: req.query.playlistType
   })
 
   return res.json(getFormattedObjects(resultList.data, resultList.total))
@@ -210,7 +210,6 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) {
 
 async function updateVideoPlaylist (req: express.Request, res: express.Response) {
   const videoPlaylistInstance = res.locals.videoPlaylistFull
-  const videoPlaylistFieldsSave = videoPlaylistInstance.toJSON()
   const videoPlaylistInfoToUpdate = req.body as VideoPlaylistUpdate
 
   const wasPrivatePlaylist = videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE
@@ -275,10 +274,9 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)
   } catch (err) {
     logger.debug('Cannot update the video playlist.', { err })
 
-    // Force fields we want to update
     // If the transaction is retried, sequelize will think the object has not changed
-    // So it will skip the SQL request, even if the last one was ROLLBACKed!
-    resetSequelizeInstance(videoPlaylistInstance, videoPlaylistFieldsSave)
+    // So we need to restore the previous fields
+    await resetSequelizeInstance(videoPlaylistInstance)
 
     throw err
   }