diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/process/process-follow.ts | 19 | ||||
-rw-r--r-- | server/lib/actor-follow-health-cache.ts | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts index f85238f8e..5562f0798 100644 --- a/server/lib/activitypub/process/process-follow.ts +++ b/server/lib/activitypub/process/process-follow.ts | |||
@@ -48,12 +48,14 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ | |||
48 | return { actorFollow: undefined as MActorFollowActors } | 48 | return { actorFollow: undefined as MActorFollowActors } |
49 | } | 49 | } |
50 | 50 | ||
51 | const [ actorFollow, created ] = await ActorFollowModel.findOrCreate<MActorFollowActors>({ | 51 | // Don't use findOrCreate by sequelize that breaks our actor follow hooks |
52 | where: { | 52 | let created = false |
53 | actorId: byActor.id, | 53 | let actorFollow: MActorFollowActors = await ActorFollowModel.loadByActorAndTarget(byActor.id, targetActor.id, t) |
54 | targetActorId: targetActor.id | 54 | |
55 | }, | 55 | if (!actorFollow) { |
56 | defaults: { | 56 | created = true |
57 | |||
58 | actorFollow = await ActorFollowModel.create({ | ||
57 | actorId: byActor.id, | 59 | actorId: byActor.id, |
58 | targetActorId: targetActor.id, | 60 | targetActorId: targetActor.id, |
59 | url: activityId, | 61 | url: activityId, |
@@ -61,9 +63,8 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ | |||
61 | state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL | 63 | state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL |
62 | ? 'pending' | 64 | ? 'pending' |
63 | : 'accepted' | 65 | : 'accepted' |
64 | }, | 66 | }, { transaction: t }) |
65 | transaction: t | 67 | } |
66 | }) | ||
67 | 68 | ||
68 | // Set the follow as accepted if the remote actor follows a channel or account | 69 | // Set the follow as accepted if the remote actor follows a channel or account |
69 | // Or if the instance automatically accepts followers | 70 | // Or if the instance automatically accepts followers |
diff --git a/server/lib/actor-follow-health-cache.ts b/server/lib/actor-follow-health-cache.ts index ab8cc98df..34357a97a 100644 --- a/server/lib/actor-follow-health-cache.ts +++ b/server/lib/actor-follow-health-cache.ts | |||
@@ -12,7 +12,7 @@ class ActorFollowHealthCache { | |||
12 | private pendingBadServer = new Set<number>() | 12 | private pendingBadServer = new Set<number>() |
13 | private pendingGoodServer = new Set<number>() | 13 | private pendingGoodServer = new Set<number>() |
14 | 14 | ||
15 | private badInboxes = new Set<string>() | 15 | private readonly badInboxes = new Set<string>() |
16 | 16 | ||
17 | private constructor () {} | 17 | private constructor () {} |
18 | 18 | ||