Merge branch 'feature/correctly-send-activities' into develop
[oweals/peertube.git] / server / lib / activitypub / send / send-create.ts
index 73e667ad4252438d8832c61008c37ad823fbfdd9..ef20e404c4b59b802fad869ea5b8a149fd7af456 100644 (file)
@@ -23,17 +23,14 @@ async function sendCreateVideo (video: VideoModel, t: Transaction) {
   return broadcastToFollowers(createActivity, byActor, [ byActor ], t)
 }
 
-async function sendCreateCacheFile (byActor: ActorModel, fileRedundancy: VideoRedundancyModel) {
+async function sendCreateCacheFile (byActor: ActorModel, video: VideoModel, fileRedundancy: VideoRedundancyModel) {
   logger.info('Creating job to send file cache of %s.', fileRedundancy.url)
 
-  const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(fileRedundancy.VideoFile.Video.id)
-  const redundancyObject = fileRedundancy.toActivityPubObject()
-
   return sendVideoRelatedCreateActivity({
     byActor,
     video,
     url: fileRedundancy.url,
-    object: redundancyObject
+    object: fileRedundancy.toActivityPubObject()
   })
 }