1 import { ActivityFollow } from '../../../../shared/models/activitypub'
2 import { ActorModel } from '../../../models/activitypub/actor'
3 import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
4 import { getActorFollowActivityPubUrl } from '../url'
5 import { unicastTo } from './utils'
7 function sendFollow (actorFollow: ActorFollowModel) {
8 const me = actorFollow.ActorFollower
9 const following = actorFollow.ActorFollowing
11 const url = getActorFollowActivityPubUrl(actorFollow)
12 const data = followActivityData(url, me, following)
14 return unicastTo(data, me, following.inboxUrl)
17 function followActivityData (url: string, byActor: ActorModel, targetActor: ActorModel): ActivityFollow {
22 object: targetActor.url
26 // ---------------------------------------------------------------------------