blob: 0324a30fa02397d46d87d150ff234317c1cf093f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import { Transaction } from 'sequelize'
import { ActivityAccept } from '../../../../shared/models/activitypub/activity'
import { AccountInstance } from '../../../models'
import { AccountFollowInstance } from '../../../models/account/account-follow-interface'
import { unicastTo } from './misc'
import { getAccountFollowAcceptActivityPubUrl } from '../../../helpers/activitypub'
async function sendAccept (accountFollow: AccountFollowInstance, t: Transaction) {
const follower = accountFollow.AccountFollower
const me = accountFollow.AccountFollowing
const url = getAccountFollowAcceptActivityPubUrl(accountFollow)
const data = await acceptActivityData(url, me)
return unicastTo(data, me, follower.inboxUrl, t)
}
// ---------------------------------------------------------------------------
export {
sendAccept
}
// ---------------------------------------------------------------------------
async function acceptActivityData (url: string, byAccount: AccountInstance) {
const activity: ActivityAccept = {
type: 'Accept',
id: url,
actor: byAccount.url
}
return activity
}
|