From 1e74f19a2179df7fc2e0da73163ef2c3118cbecb Mon Sep 17 00:00:00 2001 From: clementbrizard Date: Sat, 12 Jan 2019 13:45:23 +0000 Subject: Enable video upload and edit --- server/controllers/api/videos/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 33521a8c1..b26dcabe1 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -188,7 +188,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 @@ -325,6 +326,11 @@ async function updateVideo (req: express.Request, res: express.Response) { if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support) if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description) if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled) + 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) -- cgit v1.2.3