]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/misc.ts
Fix cc field in classic audience
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / misc.ts
index 7a21f0c94e794d0582b176138d8493647893befc..646aa9f0a25654f8ff78db621a701215242da671 100644 (file)
@@ -96,7 +96,7 @@ function getOriginVideoAudience (video: VideoModel, actorsInvolvedInVideo: Actor
   }
 }
 
-function getOriginVideoCommentAudience (
+function getVideoCommentAudience (
   videoComment: VideoCommentModel,
   threadParentComments: VideoCommentModel[],
   actorsInvolvedInVideo: ActorModel[],
@@ -126,7 +126,7 @@ function getOriginVideoCommentAudience (
 
 function getObjectFollowersAudience (actorsInvolvedInObject: ActorModel[]) {
   return {
-    to: actorsInvolvedInObject.map(a => a.followersUrl),
+    to: [ ACTIVITY_PUB.PUBLIC ].concat(actorsInvolvedInObject.map(a => a.followersUrl)),
     cc: []
   }
 }
@@ -139,9 +139,7 @@ async function getActorsInvolvedInVideo (video: VideoModel, t: Transaction) {
 }
 
 async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) {
-  const followerInboxUrls = await actorSender.getFollowerSharedInboxUrls(t)
-
-  return buildAudience(followerInboxUrls, isPublic)
+  return buildAudience([ actorSender.followersUrl ], isPublic)
 }
 
 function buildAudience (followerInboxUrls: string[], isPublic = true) {
@@ -153,14 +151,14 @@ function buildAudience (followerInboxUrls: string[], isPublic = true) {
     to = [ ACTIVITY_PUB.PUBLIC ]
     cc = followerInboxUrls
   } else { // Unlisted
-    to = followerInboxUrls
-    cc = [ ACTIVITY_PUB.PUBLIC ]
+    to = [ ]
+    cc = [ ]
   }
 
   return { to, cc }
 }
 
-function audiencify (object: any, audience: ActivityAudience) {
+function audiencify <T> (object: T, audience: ActivityAudience) {
   return Object.assign(object, audience)
 }
 
@@ -192,7 +190,7 @@ export {
   getObjectFollowersAudience,
   forwardActivity,
   audiencify,
-  getOriginVideoCommentAudience,
+  getVideoCommentAudience,
   computeUris,
   broadcastToActors
 }