X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fvideos%2Fupdate.ts;h=c0eb4ebee2f2c99020a97ccb6b43439f986b367c;hb=38d69d65012c8bf01bceb672be99f94fe414f275;hp=6f14a678828869ac34415d18b7cdebb88185e95a;hpb=9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 6f14a6788..c0eb4ebee 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts @@ -69,7 +69,7 @@ async function updateVideo (req: express.Request, res: express.Response) { }) try { - const videoInstanceUpdated = await sequelizeTypescript.transaction(async t => { + const { videoInstanceUpdated, isNewVideo } = await sequelizeTypescript.transaction(async t => { // Refresh video since thumbnails to prevent concurrent updates const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoFromReq.id, t) @@ -138,8 +138,6 @@ async function updateVideo (req: express.Request, res: express.Response) { transaction: t }) - await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, t) - auditLogger.update( getAuditIdFromRes(res), new VideoAuditView(videoInstanceUpdated.toFormattedDetailsJSON()), @@ -147,10 +145,13 @@ async function updateVideo (req: express.Request, res: express.Response) { ) logger.info('Video with name %s and uuid %s updated.', video.name, video.uuid, lTags(video.uuid)) - return videoInstanceUpdated + return { videoInstanceUpdated, isNewVideo } }) if (videoInfoToUpdate.name) await updateTorrentsMetadata(videoInstanceUpdated) + + await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, undefined) + if (wasConfidentialVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated) Hooks.runAction('action:api.video.updated', { video: videoInstanceUpdated, body: req.body, req, res }) @@ -203,5 +204,7 @@ function updateSchedule (videoInstance: MVideoFullLight, videoInfoToUpdate: Vide async function updateTorrentsMetadata (video: MVideoFullLight) { for (const file of video.getAllFiles()) { await updateTorrentMetadata(video, file) + + await file.save() } }