aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-follow.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-14 10:52:15 +0200
committerChocobozzz <me@florianbigard.com>2021-10-14 10:52:15 +0200
commite1a570abff3ebf375433e58e7362d56bd32d4cd8 (patch)
treeba3c5e58698305c3b20ed1a14c79431d873dd329 /server/lib/activitypub/process/process-follow.ts
parente89392d74aabddbee1c43dcb7e1b40d3d7eec1ed (diff)
downloadPeerTube-e1a570abff3ebf375433e58e7362d56bd32d4cd8.tar.gz
PeerTube-e1a570abff3ebf375433e58e7362d56bd32d4cd8.tar.zst
PeerTube-e1a570abff3ebf375433e58e7362d56bd32d4cd8.zip
Fix user subscription follows count
Diffstat (limited to 'server/lib/activitypub/process/process-follow.ts')
-rw-r--r--server/lib/activitypub/process/process-follow.ts26
1 files changed, 9 insertions, 17 deletions
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts
index 5562f0798..e44590ffc 100644
--- a/server/lib/activitypub/process/process-follow.ts
+++ b/server/lib/activitypub/process/process-follow.ts
@@ -48,23 +48,15 @@ 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 // Don't use findOrCreate by sequelize that breaks our actor follow hooks 51 const [ actorFollow, created ] = await ActorFollowModel.findOrCreateCustom({
52 let created = false 52 byActor,
53 let actorFollow: MActorFollowActors = await ActorFollowModel.loadByActorAndTarget(byActor.id, targetActor.id, t) 53 targetActor,
54 54 activityId,
55 if (!actorFollow) { 55 state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL
56 created = true 56 ? 'pending'
57 57 : 'accepted',
58 actorFollow = await ActorFollowModel.create({ 58 transaction: t
59 actorId: byActor.id, 59 })
60 targetActorId: targetActor.id,
61 url: activityId,
62
63 state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL
64 ? 'pending'
65 : 'accepted'
66 }, { transaction: t })
67 }
68 60
69 // Set the follow as accepted if the remote actor follows a channel or account 61 // Set the follow as accepted if the remote actor follows a channel or account
70 // Or if the instance automatically accepts followers 62 // Or if the instance automatically accepts followers