X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fvideos%2Findex.ts;h=6ac13e6a4401ad996c25ff0b19b09844a67e57a4;hb=b718fd22374d64534bcfe69932cf562894abed6a;hp=76a318d13b0951282bde551b61339becd1836e6b;hpb=501e961199578129629cf0567033d13efced9904;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 76a318d13..6ac13e6a4 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -190,7 +190,8 @@ async function addVideo (req: express.Request, res: express.Response) { support: videoInfo.support, privacy: videoInfo.privacy, duration: videoPhysicalFile['duration'], // duration was added by a previous middleware - channelId: res.locals.videoChannel.id + channelId: res.locals.videoChannel.id, + originallyPublishedAt: videoInfo.originallyPublishedAt } const video = new VideoModel(videoData) video.url = getVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object @@ -328,6 +329,11 @@ async function updateVideo (req: express.Request, res: express.Response) { if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description) if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled) if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.set('downloadEnabled', videoInfoToUpdate.downloadEnabled) + + if (videoInfoToUpdate.originallyPublishedAt !== undefined && videoInfoToUpdate.originallyPublishedAt !== null) { + videoInstance.set('originallyPublishedAt', videoInfoToUpdate.originallyPublishedAt) + } + if (videoInfoToUpdate.privacy !== undefined) { const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10) videoInstance.set('privacy', newPrivacy)