]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process-create.ts
Handle announces in inbox
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process-create.ts
index 8d842b8221589f5d791c00931191036ab1a684b4..1b825ebbcab24dcee3abb23b330910b07327c8de 100644 (file)
@@ -40,7 +40,7 @@ function processCreateVideoChannel (account: AccountInstance, videoChannelToCrea
 async function addRemoteVideoChannel (account: AccountInstance, videoChannelToCreateData: VideoChannelObject) {
   logger.debug('Adding remote video channel "%s".', videoChannelToCreateData.uuid)
 
-  await db.sequelize.transaction(async t => {
+  return db.sequelize.transaction(async t => {
     let videoChannel = await db.VideoChannel.loadByUUIDOrUrl(videoChannelToCreateData.uuid, videoChannelToCreateData.id, t)
     if (videoChannel) throw new Error('Video channel with this URL/UUID already exists.')
 
@@ -57,10 +57,11 @@ async function addRemoteVideoChannel (account: AccountInstance, videoChannelToCr
     videoChannel = db.VideoChannel.build(videoChannelData)
     videoChannel.url = getActivityPubUrl('videoChannel', videoChannel.uuid)
 
-    await videoChannel.save({ transaction: t })
-  })
+    videoChannel = await videoChannel.save({ transaction: t })
+    logger.info('Remote video channel with uuid %s inserted.', videoChannelToCreateData.uuid)
 
-  logger.info('Remote video channel with uuid %s inserted.', videoChannelToCreateData.uuid)
+    return videoChannel
+  })
 }
 
 function processCreateVideoAbuse (account: AccountInstance, videoAbuseToCreateData: VideoAbuseObject) {