]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/activitypub/actor-follow.ts
Fix broken follow notification
[github/Chocobozzz/PeerTube.git] / server / models / activitypub / actor-follow.ts
index b0461b98110f1740eb85a2d11bae9aab4128c494..3039b90c7909ed628be431992501175ef0cb8753 100644 (file)
@@ -113,6 +113,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
     ])
   }
 
+  static removeFollowsOf (actorId: number, t?: Transaction) {
+    const query = {
+      where: {
+        [Op.or]: [
+          {
+            actorId
+          },
+          {
+            targetActorId: actorId
+          }
+        ]
+      },
+      transaction: t
+    }
+
+    return ActorFollowModel.destroy(query)
+  }
+
   // Remove actor follows with a score of 0 (too many requests where they were unreachable)
   static async removeBadActorFollows () {
     const actorFollows = await ActorFollowModel.listBadActorFollows()