aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/send-flag.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/send/send-flag.ts')
-rw-r--r--server/lib/activitypub/send/send-flag.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/server/lib/activitypub/send/send-flag.ts b/server/lib/activitypub/send/send-flag.ts
index 6df4e7eb8..138eb5adc 100644
--- a/server/lib/activitypub/send/send-flag.ts
+++ b/server/lib/activitypub/send/send-flag.ts
@@ -17,16 +17,20 @@ function sendAbuse (byActor: MActor, abuse: MAbuseAP, flaggedAccount: MAccountLi
17 const audience = { to: [ flaggedAccount.Actor.url ], cc: [] } 17 const audience = { to: [ flaggedAccount.Actor.url ], cc: [] }
18 const flagActivity = buildFlagActivity(url, byActor, abuse, audience) 18 const flagActivity = buildFlagActivity(url, byActor, abuse, audience)
19 19
20 t.afterCommit(() => unicastTo(flagActivity, byActor, flaggedAccount.Actor.getSharedInbox())) 20 return t.afterCommit(() => {
21 return unicastTo({
22 data: flagActivity,
23 byActor,
24 toActorUrl: flaggedAccount.Actor.getSharedInbox(),
25 contextType: 'Flag'
26 })
27 })
21} 28}
22 29
23function buildFlagActivity (url: string, byActor: MActor, abuse: MAbuseAP, audience: ActivityAudience): ActivityFlag { 30function buildFlagActivity (url: string, byActor: MActor, abuse: MAbuseAP, audience: ActivityAudience): ActivityFlag {
24 if (!audience) audience = getAudience(byActor) 31 if (!audience) audience = getAudience(byActor)
25 32
26 const activity = Object.assign( 33 const activity = { id: url, actor: byActor.url, ...abuse.toActivityPubObject() }
27 { id: url, actor: byActor.url },
28 abuse.toActivityPubObject()
29 )
30 34
31 return audiencify(activity, audience) 35 return audiencify(activity, audience)
32} 36}