From 590fb5069038e69898123bb795f789683216d837 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 3 Aug 2018 16:23:45 +0200 Subject: Add tests regarding video import --- server/controllers/api/videos/import.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index ee11b0741..30a7d816c 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -62,7 +62,7 @@ async function addVideoImport (req: express.Request, res: express.Response) { remote: false, category: body.category || youtubeDLInfo.category, licence: body.licence || youtubeDLInfo.licence, - language: undefined, + language: body.language || undefined, commentsEnabled: body.commentsEnabled || true, waitTranscoding: body.waitTranscoding || false, state: VideoState.TO_IMPORT, @@ -102,8 +102,9 @@ async function addVideoImport (req: express.Request, res: express.Response) { videoCreated.VideoChannel = res.locals.videoChannel // Set tags to the video - if (youtubeDLInfo.tags !== undefined) { - const tagInstances = await TagModel.findOrCreateTags(youtubeDLInfo.tags, t) + const tags = body.tags ? body.tags : youtubeDLInfo.tags + if (tags !== undefined) { + const tagInstances = await TagModel.findOrCreateTags(tags, t) await videoCreated.$set('Tags', tagInstances, sequelizeOptions) videoCreated.Tags = tagInstances @@ -133,5 +134,5 @@ async function addVideoImport (req: express.Request, res: express.Response) { auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoImportAuditView(videoImport.toFormattedJSON())) - return res.json(videoImport.toFormattedJSON()) + return res.json(videoImport.toFormattedJSON()).end() } -- cgit v1.2.3