aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-03 16:23:45 +0200
committerChocobozzz <me@florianbigard.com>2018-08-06 11:19:16 +0200
commit590fb5069038e69898123bb795f789683216d837 (patch)
treeddb3d1830b7d64ebae214dd65a94dd3d16324819 /server/controllers
parent5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e (diff)
downloadPeerTube-590fb5069038e69898123bb795f789683216d837.tar.gz
PeerTube-590fb5069038e69898123bb795f789683216d837.tar.zst
PeerTube-590fb5069038e69898123bb795f789683216d837.zip
Add tests regarding video import
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/import.ts9
1 files changed, 5 insertions, 4 deletions
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) {
62 remote: false, 62 remote: false,
63 category: body.category || youtubeDLInfo.category, 63 category: body.category || youtubeDLInfo.category,
64 licence: body.licence || youtubeDLInfo.licence, 64 licence: body.licence || youtubeDLInfo.licence,
65 language: undefined, 65 language: body.language || undefined,
66 commentsEnabled: body.commentsEnabled || true, 66 commentsEnabled: body.commentsEnabled || true,
67 waitTranscoding: body.waitTranscoding || false, 67 waitTranscoding: body.waitTranscoding || false,
68 state: VideoState.TO_IMPORT, 68 state: VideoState.TO_IMPORT,
@@ -102,8 +102,9 @@ async function addVideoImport (req: express.Request, res: express.Response) {
102 videoCreated.VideoChannel = res.locals.videoChannel 102 videoCreated.VideoChannel = res.locals.videoChannel
103 103
104 // Set tags to the video 104 // Set tags to the video
105 if (youtubeDLInfo.tags !== undefined) { 105 const tags = body.tags ? body.tags : youtubeDLInfo.tags
106 const tagInstances = await TagModel.findOrCreateTags(youtubeDLInfo.tags, t) 106 if (tags !== undefined) {
107 const tagInstances = await TagModel.findOrCreateTags(tags, t)
107 108
108 await videoCreated.$set('Tags', tagInstances, sequelizeOptions) 109 await videoCreated.$set('Tags', tagInstances, sequelizeOptions)
109 videoCreated.Tags = tagInstances 110 videoCreated.Tags = tagInstances
@@ -133,5 +134,5 @@ async function addVideoImport (req: express.Request, res: express.Response) {
133 134
134 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoImportAuditView(videoImport.toFormattedJSON())) 135 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoImportAuditView(videoImport.toFormattedJSON()))
135 136
136 return res.json(videoImport.toFormattedJSON()) 137 return res.json(videoImport.toFormattedJSON()).end()
137} 138}