diff options
author | Chocobozzz <me@florianbigard.com> | 2019-11-28 11:37:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-11-28 11:37:32 +0100 |
commit | b8f4167fb6fa448125aeecff80b201d74e27fe6a (patch) | |
tree | 33179fe38e113b3bd88bae9782f4741754a85159 /client/src/app | |
parent | d275e75453015352d5b9387eaf5078e1ba5e0ea2 (diff) | |
download | PeerTube-b8f4167fb6fa448125aeecff80b201d74e27fe6a.tar.gz PeerTube-b8f4167fb6fa448125aeecff80b201d74e27fe6a.tar.zst PeerTube-b8f4167fb6fa448125aeecff80b201d74e27fe6a.zip |
Only display accepted followers/followings in about page
Diffstat (limited to 'client/src/app')
4 files changed, 23 insertions, 7 deletions
diff --git a/client/src/app/+about/about-follows/about-follows.component.ts b/client/src/app/+about/about-follows/about-follows.component.ts index d60307928..fc265fecb 100644 --- a/client/src/app/+about/about-follows/about-follows.component.ts +++ b/client/src/app/+about/about-follows/about-follows.component.ts | |||
@@ -74,7 +74,7 @@ export class AboutFollowsComponent implements OnInit { | |||
74 | private loadMoreFollowers () { | 74 | private loadMoreFollowers () { |
75 | const pagination = this.restService.componentPaginationToRestPagination(this.followersPagination) | 75 | const pagination = this.restService.componentPaginationToRestPagination(this.followersPagination) |
76 | 76 | ||
77 | this.followService.getFollowers(pagination, this.sort) | 77 | this.followService.getFollowers({ pagination: pagination, sort: this.sort, state: 'accepted' }) |
78 | .subscribe( | 78 | .subscribe( |
79 | resultList => { | 79 | resultList => { |
80 | const newFollowers = resultList.data.map(r => r.follower.host) | 80 | const newFollowers = resultList.data.map(r => r.follower.host) |
@@ -92,7 +92,7 @@ export class AboutFollowsComponent implements OnInit { | |||
92 | private loadMoreFollowings () { | 92 | private loadMoreFollowings () { |
93 | const pagination = this.restService.componentPaginationToRestPagination(this.followingsPagination) | 93 | const pagination = this.restService.componentPaginationToRestPagination(this.followingsPagination) |
94 | 94 | ||
95 | this.followService.getFollowing(pagination, this.sort) | 95 | this.followService.getFollowing({ pagination, sort: this.sort, state: 'accepted' }) |
96 | .subscribe( | 96 | .subscribe( |
97 | resultList => { | 97 | resultList => { |
98 | const newFollowings = resultList.data.map(r => r.following.host) | 98 | const newFollowings = resultList.data.map(r => r.following.host) |
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index eb3137e26..707daef84 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts | |||
@@ -88,7 +88,7 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
88 | } | 88 | } |
89 | 89 | ||
90 | protected loadData () { | 90 | protected loadData () { |
91 | this.followService.getFollowers(this.pagination, this.sort, this.search) | 91 | this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search }) |
92 | .subscribe( | 92 | .subscribe( |
93 | resultList => { | 93 | resultList => { |
94 | this.followers = resultList.data | 94 | this.followers = resultList.data |
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index b97923f04..3d78c254f 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts | |||
@@ -50,7 +50,7 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
50 | } | 50 | } |
51 | 51 | ||
52 | protected loadData () { | 52 | protected loadData () { |
53 | this.followService.getFollowing(this.pagination, this.sort, this.search) | 53 | this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search }) |
54 | .subscribe( | 54 | .subscribe( |
55 | resultList => { | 55 | resultList => { |
56 | this.following = resultList.data | 56 | this.following = resultList.data |
diff --git a/client/src/app/shared/instance/follow.service.ts b/client/src/app/shared/instance/follow.service.ts index 63f9e2687..1477a26ae 100644 --- a/client/src/app/shared/instance/follow.service.ts +++ b/client/src/app/shared/instance/follow.service.ts | |||
@@ -2,7 +2,7 @@ import { catchError, map } from 'rxjs/operators' | |||
2 | import { HttpClient, HttpParams } from '@angular/common/http' | 2 | import { HttpClient, HttpParams } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { Observable } from 'rxjs' | 4 | import { Observable } from 'rxjs' |
5 | import { ActorFollow, ResultList } from '@shared/index' | 5 | import { ActorFollow, FollowState, ResultList } from '@shared/index' |
6 | import { environment } from '../../../environments/environment' | 6 | import { environment } from '../../../environments/environment' |
7 | import { RestExtractor, RestPagination, RestService } from '../rest' | 7 | import { RestExtractor, RestPagination, RestService } from '../rest' |
8 | import { SortMeta } from 'primeng/api' | 8 | import { SortMeta } from 'primeng/api' |
@@ -18,11 +18,19 @@ export class FollowService { | |||
18 | ) { | 18 | ) { |
19 | } | 19 | } |
20 | 20 | ||
21 | getFollowing (pagination: RestPagination, sort: SortMeta, search?: string): Observable<ResultList<ActorFollow>> { | 21 | getFollowing (options: { |
22 | pagination: RestPagination, | ||
23 | sort: SortMeta, | ||
24 | search?: string, | ||
25 | state?: FollowState | ||
26 | }): Observable<ResultList<ActorFollow>> { | ||
27 | const { pagination, sort, search, state } = options | ||
28 | |||
22 | let params = new HttpParams() | 29 | let params = new HttpParams() |
23 | params = this.restService.addRestGetParams(params, pagination, sort) | 30 | params = this.restService.addRestGetParams(params, pagination, sort) |
24 | 31 | ||
25 | if (search) params = params.append('search', search) | 32 | if (search) params = params.append('search', search) |
33 | if (state) params = params.append('state', state) | ||
26 | 34 | ||
27 | return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/following', { params }) | 35 | return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/following', { params }) |
28 | .pipe( | 36 | .pipe( |
@@ -31,11 +39,19 @@ export class FollowService { | |||
31 | ) | 39 | ) |
32 | } | 40 | } |
33 | 41 | ||
34 | getFollowers (pagination: RestPagination, sort: SortMeta, search?: string): Observable<ResultList<ActorFollow>> { | 42 | getFollowers (options: { |
43 | pagination: RestPagination, | ||
44 | sort: SortMeta, | ||
45 | search?: string, | ||
46 | state?: FollowState | ||
47 | }): Observable<ResultList<ActorFollow>> { | ||
48 | const { pagination, sort, search, state } = options | ||
49 | |||
35 | let params = new HttpParams() | 50 | let params = new HttpParams() |
36 | params = this.restService.addRestGetParams(params, pagination, sort) | 51 | params = this.restService.addRestGetParams(params, pagination, sort) |
37 | 52 | ||
38 | if (search) params = params.append('search', search) | 53 | if (search) params = params.append('search', search) |
54 | if (state) params = params.append('state', state) | ||
39 | 55 | ||
40 | return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) | 56 | return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) |
41 | .pipe( | 57 | .pipe( |