Refractor activities sending

This commit is contained in:
Chocobozzz 2018-09-14 16:51:35 +02:00
parent d61b817890
commit a2377d15ee
No known key found for this signature in database
GPG key ID: 583A612D890159BE
11 changed files with 140 additions and 155 deletions

View file

@ -6,7 +6,7 @@ import { VideoModel } from '../../models/video/video'
import { VideoCommentModel } from '../../models/video/video-comment'
import { VideoShareModel } from '../../models/video/video-share'
function getVideoAudience (video: VideoModel, actorsInvolvedInVideo: ActorModel[]) {
function getRemoteVideoAudience (video: VideoModel, actorsInvolvedInVideo: ActorModel[]): ActivityAudience {
return {
to: [ video.VideoChannel.Account.Actor.url ],
cc: actorsInvolvedInVideo.map(a => a.followersUrl)
@ -18,7 +18,7 @@ function getVideoCommentAudience (
threadParentComments: VideoCommentModel[],
actorsInvolvedInVideo: ActorModel[],
isOrigin = false
) {
): ActivityAudience {
const to = [ ACTIVITY_PUB.PUBLIC ]
const cc: string[] = []
@ -41,7 +41,7 @@ function getVideoCommentAudience (
}
}
function getObjectFollowersAudience (actorsInvolvedInObject: ActorModel[]) {
function getAudienceFromFollowersOf (actorsInvolvedInObject: ActorModel[]): ActivityAudience {
return {
to: [ ACTIVITY_PUB.PUBLIC ].concat(actorsInvolvedInObject.map(a => a.followersUrl)),
cc: []
@ -83,9 +83,9 @@ function audiencify<T> (object: T, audience: ActivityAudience) {
export {
buildAudience,
getAudience,
getVideoAudience,
getRemoteVideoAudience,
getActorsInvolvedInVideo,
getObjectFollowersAudience,
getAudienceFromFollowersOf,
audiencify,
getVideoCommentAudience
}