]> 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 607822d1623ec8a7f4642a68b4400ef46eb5c778..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) {
@@ -160,7 +158,7 @@ function buildAudience (followerInboxUrls: string[], isPublic = true) {
   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
 }