1 import { Transaction } from 'sequelize'
2 import { ActivityAccept } from '../../../../shared/models/activitypub'
3 import { AccountModel } from '../../../models/account/account'
4 import { AccountFollowModel } from '../../../models/account/account-follow'
5 import { getAccountFollowAcceptActivityPubUrl } from '../url'
6 import { unicastTo } from './misc'
8 async function sendAccept (accountFollow: AccountFollowModel, t: Transaction) {
9 const follower = accountFollow.AccountFollower
10 const me = accountFollow.AccountFollowing
12 const url = getAccountFollowAcceptActivityPubUrl(accountFollow)
13 const data = acceptActivityData(url, me)
15 return unicastTo(data, me, follower.inboxUrl, t)
18 // ---------------------------------------------------------------------------
24 // ---------------------------------------------------------------------------
26 function acceptActivityData (url: string, byAccount: AccountModel) {
27 const activity: ActivityAccept = {