-function getVideoAudience (video: VideoModel, actorsInvolvedInVideo: ActorModel[]) {
- return {
- to: [ video.VideoChannel.Account.Actor.url ],
- cc: actorsInvolvedInVideo.map(a => a.followersUrl)
- }
-}
-
-function getVideoCommentAudience (
- videoComment: VideoCommentModel,
- threadParentComments: VideoCommentModel[],
- actorsInvolvedInVideo: ActorModel[],
- isOrigin = false
-) {
- const to = [ ACTIVITY_PUB.PUBLIC ]
- const cc = [ ]
-
- // Owner of the video we comment
- if (isOrigin === false) {
- cc.push(videoComment.Video.VideoChannel.Account.Actor.url)
- }
-
- // Followers of the poster
- cc.push(videoComment.Account.Actor.followersUrl)
-
- // Send to actors we reply to
- for (const parentComment of threadParentComments) {
- cc.push(parentComment.Account.Actor.url)
- }
-
- return {
- to,
- cc: cc.concat(actorsInvolvedInVideo.map(a => a.followersUrl))
- }
-}
-
-function getObjectFollowersAudience (actorsInvolvedInObject: ActorModel[]) {
- return {
- to: [ ACTIVITY_PUB.PUBLIC ].concat(actorsInvolvedInObject.map(a => a.followersUrl)),
- cc: []
- }
-}
-
-async function getActorsInvolvedInVideo (video: VideoModel, t: Transaction) {
- const actors = await VideoShareModel.loadActorsByShare(video.id, t)
- actors.push(video.VideoChannel.Account.Actor)
-
- return actors
-}
-
-async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) {