]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process-add.ts
Handle announces in inbox
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process-add.ts
index 06d23a2ea4e5436a5c73d8f864fe8988945d7224..98e414dbb9372bfa0710900c1c8a3d1a7160c933 100644 (file)
@@ -39,7 +39,7 @@ function processAddVideo (account: AccountInstance, videoChannelUrl: string, vid
 async function addRemoteVideo (account: AccountInstance, videoChannelUrl: string, videoToCreateData: VideoTorrentObject) {
   logger.debug('Adding remote video %s.', videoToCreateData.url)
 
-  await db.sequelize.transaction(async t => {
+  return db.sequelize.transaction(async t => {
     const sequelizeOptions = {
       transaction: t
     }
@@ -66,7 +66,10 @@ async function addRemoteVideo (account: AccountInstance, videoChannelUrl: string
     const tags = videoToCreateData.tag.map(t => t.name)
     const tagInstances = await db.Tag.findOrCreateTags(tags, t)
     await videoCreated.setTags(tagInstances, sequelizeOptions)
+
+    logger.info('Remote video with uuid %s inserted.', videoToCreateData.uuid)
+
+    return videoCreated
   })
 
-  logger.info('Remote video with uuid %s inserted.', videoToCreateData.uuid)
 }