aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/activitypub-follow.ts18
1 files changed, 5 insertions, 13 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts
index 91e3d33c6..55a15930a 100644
--- a/server/lib/job-queue/handlers/activitypub-follow.ts
+++ b/server/lib/job-queue/handlers/activitypub-follow.ts
@@ -54,21 +54,13 @@ async function follow (fromActor: MActor, targetActor: MActorFull, isAutoFollow
54 const state = !fromActor.serverId && !targetActor.serverId ? 'accepted' : 'pending' 54 const state = !fromActor.serverId && !targetActor.serverId ? 'accepted' : 'pending'
55 55
56 const actorFollow = await sequelizeTypescript.transaction(async t => { 56 const actorFollow = await sequelizeTypescript.transaction(async t => {
57 const [ actorFollow ] = await ActorFollowModel.findOrCreate<MActorFollowActors>({ 57 const [ actorFollow ] = await ActorFollowModel.findOrCreateCustom({
58 where: { 58 byActor: fromActor,
59 actorId: fromActor.id, 59 state,
60 targetActorId: targetActor.id 60 targetActor,
61 }, 61 activityId: getLocalActorFollowActivityPubUrl(fromActor, targetActor),
62 defaults: {
63 state,
64 url: getLocalActorFollowActivityPubUrl(fromActor, targetActor),
65 actorId: fromActor.id,
66 targetActorId: targetActor.id
67 },
68 transaction: t 62 transaction: t
69 }) 63 })
70 actorFollow.ActorFollowing = targetActor
71 actorFollow.ActorFollower = fromActor
72 64
73 // Send a notification to remote server if our follow is not already accepted 65 // Send a notification to remote server if our follow is not already accepted
74 if (actorFollow.state !== 'accepted') sendFollow(actorFollow, t) 66 if (actorFollow.state !== 'accepted') sendFollow(actorFollow, t)