aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-follow.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/process/process-follow.ts')
-rw-r--r--server/lib/activitypub/process/process-follow.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts
index 7eb7e828d..076ad9cf4 100644
--- a/server/lib/activitypub/process/process-follow.ts
+++ b/server/lib/activitypub/process/process-follow.ts
@@ -15,9 +15,11 @@ import { getServerActor } from '@server/models/application/application'
15 15
16async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) { 16async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) {
17 const { activity, byActor } = options 17 const { activity, byActor } = options
18 const activityObject = getAPId(activity.object)
19 18
20 return retryTransactionWrapper(processFollow, byActor, activityObject) 19 const activityId = activity.id
20 const objectId = getAPId(activity.object)
21
22 return retryTransactionWrapper(processFollow, byActor, activityId, objectId)
21} 23}
22 24
23// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
@@ -28,7 +30,7 @@ export {
28 30
29// --------------------------------------------------------------------------- 31// ---------------------------------------------------------------------------
30 32
31async function processFollow (byActor: MActorSignature, targetActorURL: string) { 33async function processFollow (byActor: MActorSignature, activityId: string, targetActorURL: string) {
32 const { actorFollow, created, isFollowingInstance, targetActor } = await sequelizeTypescript.transaction(async t => { 34 const { actorFollow, created, isFollowingInstance, targetActor } = await sequelizeTypescript.transaction(async t => {
33 const targetActor = await ActorModel.loadByUrlAndPopulateAccountAndChannel(targetActorURL, t) 35 const targetActor = await ActorModel.loadByUrlAndPopulateAccountAndChannel(targetActorURL, t)
34 36
@@ -41,7 +43,7 @@ async function processFollow (byActor: MActorSignature, targetActorURL: string)
41 if (isFollowingInstance && CONFIG.FOLLOWERS.INSTANCE.ENABLED === false) { 43 if (isFollowingInstance && CONFIG.FOLLOWERS.INSTANCE.ENABLED === false) {
42 logger.info('Rejecting %s because instance followers are disabled.', targetActor.url) 44 logger.info('Rejecting %s because instance followers are disabled.', targetActor.url)
43 45
44 await sendReject(byActor, targetActor) 46 await sendReject(activityId, byActor, targetActor)
45 47
46 return { actorFollow: undefined as MActorFollowActors } 48 return { actorFollow: undefined as MActorFollowActors }
47 } 49 }
@@ -54,7 +56,11 @@ async function processFollow (byActor: MActorSignature, targetActorURL: string)
54 defaults: { 56 defaults: {
55 actorId: byActor.id, 57 actorId: byActor.id,
56 targetActorId: targetActor.id, 58 targetActorId: targetActor.id,
57 state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL ? 'pending' : 'accepted' 59 url: activityId,
60
61 state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL
62 ? 'pending'
63 : 'accepted'
58 }, 64 },
59 transaction: t 65 transaction: t
60 }) 66 })