aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/import.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-20 10:22:05 +0200
committerChocobozzz <me@florianbigard.com>2019-08-20 10:22:05 +0200
commit96ca24f00e5ae5471dee9ee596489fe50af2b46f (patch)
tree64b7091518d802cc6e812bbe0787e11eeed2fcd5 /server/controllers/api/videos/import.ts
parent453e83ea5d81d203ba34bc43cd5c2c750ba40568 (diff)
downloadPeerTube-96ca24f00e5ae5471dee9ee596489fe50af2b46f.tar.gz
PeerTube-96ca24f00e5ae5471dee9ee596489fe50af2b46f.tar.zst
PeerTube-96ca24f00e5ae5471dee9ee596489fe50af2b46f.zip
Fix tests
Diffstat (limited to 'server/controllers/api/videos/import.ts')
-rw-r--r--server/controllers/api/videos/import.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index adc2f9aa2..a058b37ef 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -28,6 +28,7 @@ import {
28 MChannelActorAccountDefault, 28 MChannelActorAccountDefault,
29 MThumbnail, 29 MThumbnail,
30 MUser, 30 MUser,
31 MVideoTag,
31 MVideoThumbnailAccountDefault, 32 MVideoThumbnailAccountDefault,
32 MVideoWithBlacklistLight 33 MVideoWithBlacklistLight
33} from '@server/typings/models' 34} from '@server/typings/models'
@@ -244,7 +245,7 @@ function insertIntoDB (parameters: {
244 const sequelizeOptions = { transaction: t } 245 const sequelizeOptions = { transaction: t }
245 246
246 // Save video object in database 247 // Save video object in database
247 const videoCreated = await video.save(sequelizeOptions) as (MVideoThumbnailAccountDefault & MVideoWithBlacklistLight) 248 const videoCreated = await video.save(sequelizeOptions) as (MVideoThumbnailAccountDefault & MVideoWithBlacklistLight & MVideoTag)
248 videoCreated.VideoChannel = videoChannel 249 videoCreated.VideoChannel = videoChannel
249 250
250 if (thumbnailModel) await videoCreated.addAndSaveThumbnail(thumbnailModel, t) 251 if (thumbnailModel) await videoCreated.addAndSaveThumbnail(thumbnailModel, t)
@@ -264,6 +265,9 @@ function insertIntoDB (parameters: {
264 const tagInstances = await TagModel.findOrCreateTags(tags, t) 265 const tagInstances = await TagModel.findOrCreateTags(tags, t)
265 266
266 await videoCreated.$set('Tags', tagInstances, sequelizeOptions) 267 await videoCreated.$set('Tags', tagInstances, sequelizeOptions)
268 videoCreated.Tags = tagInstances
269 } else {
270 videoCreated.Tags = []
267 } 271 }
268 272
269 // Create video import object in database 273 // Create video import object in database