1 import { Transaction } from 'sequelize'
2 import { ActivityFollow } from '../../../../shared/models/activitypub'
3 import { AccountModel } from '../../../models/account/account'
4 import { AccountFollowModel } from '../../../models/account/account-follow'
5 import { getAccountFollowActivityPubUrl } from '../url'
6 import { unicastTo } from './misc'
8 function sendFollow (accountFollow: AccountFollowModel, t: Transaction) {
9 const me = accountFollow.AccountFollower
10 const following = accountFollow.AccountFollowing
12 const url = getAccountFollowActivityPubUrl(accountFollow)
13 const data = followActivityData(url, me, following)
15 return unicastTo(data, me, following.inboxUrl, t)
18 function followActivityData (url: string, byAccount: AccountModel, targetAccount: AccountModel): ActivityFollow {
23 object: targetAccount.url
27 // ---------------------------------------------------------------------------