aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/send-accept.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/send/send-accept.ts')
-rw-r--r--server/lib/activitypub/send/send-accept.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/lib/activitypub/send/send-accept.ts b/server/lib/activitypub/send/send-accept.ts
index 7579884a7..4eaa329d9 100644
--- a/server/lib/activitypub/send/send-accept.ts
+++ b/server/lib/activitypub/send/send-accept.ts
@@ -1,16 +1,20 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { ActivityAccept } from '../../../../shared/models/activitypub' 2import { ActivityAccept, ActivityFollow } from '../../../../shared/models/activitypub'
3import { ActorModel } from '../../../models/activitypub/actor' 3import { ActorModel } from '../../../models/activitypub/actor'
4import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 4import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
5import { getActorFollowAcceptActivityPubUrl } from '../url' 5import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url'
6import { unicastTo } from './misc' 6import { unicastTo } from './misc'
7import { followActivityData } from './send-follow'
7 8
8async function sendAccept (actorFollow: ActorFollowModel, t: Transaction) { 9async function sendAccept (actorFollow: ActorFollowModel, t: Transaction) {
9 const follower = actorFollow.ActorFollower 10 const follower = actorFollow.ActorFollower
10 const me = actorFollow.ActorFollowing 11 const me = actorFollow.ActorFollowing
11 12
13 const followUrl = getActorFollowActivityPubUrl(actorFollow)
14 const followData = followActivityData(followUrl, follower, me)
15
12 const url = getActorFollowAcceptActivityPubUrl(actorFollow) 16 const url = getActorFollowAcceptActivityPubUrl(actorFollow)
13 const data = acceptActivityData(url, me) 17 const data = acceptActivityData(url, me, followData)
14 18
15 return unicastTo(data, me, follower.inboxUrl, t) 19 return unicastTo(data, me, follower.inboxUrl, t)
16} 20}
@@ -23,10 +27,11 @@ export {
23 27
24// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
25 29
26function acceptActivityData (url: string, byActor: ActorModel): ActivityAccept { 30function acceptActivityData (url: string, byActor: ActorModel, followActivityData: ActivityFollow): ActivityAccept {
27 return { 31 return {
28 type: 'Accept', 32 type: 'Accept',
29 id: url, 33 id: url,
30 actor: byActor.url 34 actor: byActor.url,
35 object: followActivityData
31 } 36 }
32} 37}