diff options
Diffstat (limited to 'server/controllers/api/videos/update.ts')
-rw-r--r-- | server/controllers/api/videos/update.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 260dee2b9..e6197c4b1 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts | |||
@@ -45,7 +45,6 @@ export { | |||
45 | 45 | ||
46 | async function updateVideo (req: express.Request, res: express.Response) { | 46 | async function updateVideo (req: express.Request, res: express.Response) { |
47 | const videoFromReq = res.locals.videoAll | 47 | const videoFromReq = res.locals.videoAll |
48 | const videoFieldsSave = videoFromReq.toJSON() | ||
49 | const oldVideoAuditView = new VideoAuditView(videoFromReq.toFormattedDetailsJSON()) | 48 | const oldVideoAuditView = new VideoAuditView(videoFromReq.toFormattedDetailsJSON()) |
50 | const videoInfoToUpdate: VideoUpdate = req.body | 49 | const videoInfoToUpdate: VideoUpdate = req.body |
51 | 50 | ||
@@ -151,10 +150,9 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
151 | isNewVideo | 150 | isNewVideo |
152 | }) | 151 | }) |
153 | } catch (err) { | 152 | } catch (err) { |
154 | // Force fields we want to update | ||
155 | // If the transaction is retried, sequelize will think the object has not changed | 153 | // If the transaction is retried, sequelize will think the object has not changed |
156 | // So it will skip the SQL request, even if the last one was ROLLBACKed! | 154 | // So we need to restore the previous fields |
157 | resetSequelizeInstance(videoFromReq, videoFieldsSave) | 155 | resetSequelizeInstance(videoFromReq) |
158 | 156 | ||
159 | throw err | 157 | throw err |
160 | } finally { | 158 | } finally { |