]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process/process-follow.ts
Fix user subscription follows count
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process / process-follow.ts
index f85238f8e73ba50635ea9f174fb2f51373ab5216..e44590ffc52317f3e3982267e94046b37d97ad79 100644 (file)
@@ -48,20 +48,13 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ
       return { actorFollow: undefined as MActorFollowActors }
     }
 
-    const [ actorFollow, created ] = await ActorFollowModel.findOrCreate<MActorFollowActors>({
-      where: {
-        actorId: byActor.id,
-        targetActorId: targetActor.id
-      },
-      defaults: {
-        actorId: byActor.id,
-        targetActorId: targetActor.id,
-        url: activityId,
-
-        state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL
-          ? 'pending'
-          : 'accepted'
-      },
+    const [ actorFollow, created ] = await ActorFollowModel.findOrCreateCustom({
+      byActor,
+      targetActor,
+      activityId,
+      state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL
+        ? 'pending'
+        : 'accepted',
       transaction: t
     })