-async function createActivityData (
- url: string,
- byActor: ActorModel,
- object: any,
- t: Transaction,
- audience?: ActivityAudience
-): Promise<ActivityCreate> {
- if (!audience) {
- audience = await getAudience(byActor, t)
+ const createActivity = buildCreateActivity(comment.url, byActor, commentObject, audience)
+
+ // This was a reply, send it to the parent actors
+ const actorsException = [ byActor ]
+ await broadcastToActors({
+ data: createActivity,
+ byActor,
+ toActors: parentsCommentActors,
+ transaction,
+ actorsException,
+ contextType: 'Comment'
+ })
+
+ // Broadcast to our followers
+ await broadcastToFollowers({
+ data: createActivity,
+ byActor,
+ toFollowersOf: [ byActor ],
+ transaction,
+ contextType: 'Comment'
+ })
+
+ // Send to actors involved in the comment
+ if (isOrigin) {
+ return broadcastToFollowers({
+ data: createActivity,
+ byActor,
+ toFollowersOf: actorsInvolvedInComment,
+ transaction,
+ actorsException,
+ contextType: 'Comment'
+ })