]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/send-create.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / send-create.ts
index 26ec3e94873ea619796754fd5ffc50ce3525bb9e..8bdcf6417cf64f12e42d17f96b6eea21bb179a0d 100644 (file)
@@ -16,9 +16,10 @@ import {
   MVideoRedundancyFileVideo,
   MVideoRedundancyStreamingPlaylistVideo
 } from '../../../typings/models'
+import { ContextType } from '@server/helpers/activitypub'
 
 async function sendCreateVideo (video: MVideoAP, t: Transaction) {
-  if (video.privacy === VideoPrivacy.PRIVATE) return undefined
+  if (!video.hasPrivacyForFederation()) return undefined
 
   logger.info('Creating job to send video creation of %s.', video.url)
 
@@ -42,7 +43,8 @@ async function sendCreateCacheFile (
     byActor,
     video,
     url: fileRedundancy.url,
-    object: fileRedundancy.toActivityPubObject()
+    object: fileRedundancy.toActivityPubObject(),
+    contextType: 'CacheFile'
   })
 }
 
@@ -100,7 +102,7 @@ async function sendCreateVideoComment (comment: MCommentOwnerVideo, t: Transacti
   if (isOrigin) return broadcastToFollowers(createActivity, byActor, actorsInvolvedInComment, t, actorsException)
 
   // Send to origin
-  t.afterCommit(() => unicastTo(createActivity, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl))
+  t.afterCommit(() => unicastTo(createActivity, byActor, comment.Video.VideoChannel.Account.Actor.getSharedInbox()))
 }
 
 function buildCreateActivity (url: string, byActor: MActorLight, object: any, audience?: ActivityAudience): ActivityCreate {
@@ -130,11 +132,12 @@ export {
 // ---------------------------------------------------------------------------
 
 async function sendVideoRelatedCreateActivity (options: {
-  byActor: MActorLight,
-  video: MVideoAccountLight,
-  url: string,
-  object: any,
+  byActor: MActorLight
+  video: MVideoAccountLight
+  url: string
+  object: any
   transaction?: Transaction
+  contextType?: ContextType
 }) {
   const activityBuilder = (audience: ActivityAudience) => {
     return buildCreateActivity(options.url, options.byActor, options.object, audience)