aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
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/job-queue
parente89392d74aabddbee1c43dcb7e1b40d3d7eec1ed (diff)
downloadPeerTube-e1a570abff3ebf375433e58e7362d56bd32d4cd8.tar.gz
PeerTube-e1a570abff3ebf375433e58e7362d56bd32d4cd8.tar.zst
PeerTube-e1a570abff3ebf375433e58e7362d56bd32d4cd8.zip
Fix user subscription follows count
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)