]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/instance/follow.service.ts
Filter on follows actor types in about page
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / instance / follow.service.ts
index 1477a26ae8120d737341629f43763309190965ef..ef4c0958319271c92b51368f4d5fbf8c2f4a0388 100644 (file)
@@ -2,7 +2,7 @@ import { catchError, map } from 'rxjs/operators'
 import { HttpClient, HttpParams } from '@angular/common/http'
 import { Injectable } from '@angular/core'
 import { Observable } from 'rxjs'
-import { ActorFollow, FollowState, ResultList } from '@shared/index'
+import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/index'
 import { environment } from '../../../environments/environment'
 import { RestExtractor, RestPagination, RestService } from '../rest'
 import { SortMeta } from 'primeng/api'
@@ -22,15 +22,17 @@ export class FollowService {
     pagination: RestPagination,
     sort: SortMeta,
     search?: string,
+    actorType?: ActivityPubActorType,
     state?: FollowState
   }): Observable<ResultList<ActorFollow>> {
-    const { pagination, sort, search, state } = options
+    const { pagination, sort, search, state, actorType } = options
 
     let params = new HttpParams()
     params = this.restService.addRestGetParams(params, pagination, sort)
 
     if (search) params = params.append('search', search)
     if (state) params = params.append('state', state)
+    if (actorType) params = params.append('actorType', actorType)
 
     return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/following', { params })
                .pipe(
@@ -43,15 +45,17 @@ export class FollowService {
     pagination: RestPagination,
     sort: SortMeta,
     search?: string,
+    actorType?: ActivityPubActorType,
     state?: FollowState
   }): Observable<ResultList<ActorFollow>> {
-    const { pagination, sort, search, state } = options
+    const { pagination, sort, search, state, actorType } = options
 
     let params = new HttpParams()
     params = this.restService.addRestGetParams(params, pagination, sort)
 
     if (search) params = params.append('search', search)
     if (state) params = params.append('state', state)
+    if (actorType) params = params.append('actorType', actorType)
 
     return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params })
                .pipe(