]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/activitypub/actor-follow.ts
Only display accepted followers/followings in about page
[github/Chocobozzz/PeerTube.git] / server / models / activitypub / actor-follow.ts
index 24272a40ea87f1fb08bcac6656ae426e31b2f6eb..09bc6853d6091732f4182c9290d6201c615371bc 100644 (file)
@@ -292,12 +292,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
     return ActorFollowModel.findAll(query)
   }
 
-  static listFollowingForApi (id: number, start: number, count: number, sort: string, search?: string) {
+  static listFollowingForApi (options: {
+    id: number,
+    start: number,
+    count: number,
+    sort: string,
+    state?: FollowState,
+    search?: string
+  }) {
+    const { id, start, count, sort, search, state } = options
+
+    const followWhere = state ? { state } : {}
+
     const query = {
       distinct: true,
       offset: start,
       limit: count,
       order: getSort(sort),
+      where: followWhere,
       include: [
         {
           model: ActorModel,
@@ -335,12 +347,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
       })
   }
 
-  static listFollowersForApi (actorId: number, start: number, count: number, sort: string, search?: string) {
+  static listFollowersForApi (options: {
+    actorId: number,
+    start: number,
+    count: number,
+    sort: string,
+    state?: FollowState,
+    search?: string
+  }) {
+    const { actorId, start, count, sort, search, state } = options
+
+    const followWhere = state ? { state } : {}
+
     const query = {
       distinct: true,
       offset: start,
       limit: count,
       order: getSort(sort),
+      where: followWhere,
       include: [
         {
           model: ActorModel,