aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-27 11:05:32 +0200
committerChocobozzz <me@florianbigard.com>2022-07-27 13:52:13 +0200
commit073deef8862f462de5f159a57877ef415ebe4c69 (patch)
tree256d5ff4483ef68b07754f767626a72ac793bd5f /client/src/app/shared
parent3267d381f4fdd128b2f948670b2e2ba765145276 (diff)
downloadPeerTube-073deef8862f462de5f159a57877ef415ebe4c69.tar.gz
PeerTube-073deef8862f462de5f159a57877ef415ebe4c69.tar.zst
PeerTube-073deef8862f462de5f159a57877ef415ebe4c69.zip
Handle rejected follows in client
Also add quick filters so it's easier to find pending follows
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-instance/instance-follow.service.ts41
1 files changed, 39 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-instance/instance-follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.ts
index a83f7c4ad..06484d938 100644
--- a/client/src/app/shared/shared-instance/instance-follow.service.ts
+++ b/client/src/app/shared/shared-instance/instance-follow.service.ts
@@ -6,6 +6,7 @@ import { Injectable } from '@angular/core'
6import { RestExtractor, RestPagination, RestService } from '@app/core' 6import { RestExtractor, RestPagination, RestService } from '@app/core'
7import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@shared/models' 7import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@shared/models'
8import { environment } from '../../../environments/environment' 8import { environment } from '../../../environments/environment'
9import { AdvancedInputFilter } from '../shared-forms'
9 10
10@Injectable() 11@Injectable()
11export class InstanceFollowService { 12export class InstanceFollowService {
@@ -30,7 +31,10 @@ export class InstanceFollowService {
30 let params = new HttpParams() 31 let params = new HttpParams()
31 params = this.restService.addRestGetParams(params, pagination, sort) 32 params = this.restService.addRestGetParams(params, pagination, sort)
32 33
33 if (search) params = params.append('search', search) 34 if (search) {
35 params = this.restService.addObjectParams(params, this.parseFollowsListFilters(search))
36 }
37
34 if (state) params = params.append('state', state) 38 if (state) params = params.append('state', state)
35 if (actorType) params = params.append('actorType', actorType) 39 if (actorType) params = params.append('actorType', actorType)
36 40
@@ -53,7 +57,10 @@ export class InstanceFollowService {
53 let params = new HttpParams() 57 let params = new HttpParams()
54 params = this.restService.addRestGetParams(params, pagination, sort) 58 params = this.restService.addRestGetParams(params, pagination, sort)
55 59
56 if (search) params = params.append('search', search) 60 if (search) {
61 params = this.restService.addObjectParams(params, this.parseFollowsListFilters(search))
62 }
63
57 if (state) params = params.append('state', state) 64 if (state) params = params.append('state', state)
58 if (actorType) params = params.append('actorType', actorType) 65 if (actorType) params = params.append('actorType', actorType)
59 66
@@ -101,4 +108,34 @@ export class InstanceFollowService {
101 return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`) 108 return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`)
102 .pipe(catchError(res => this.restExtractor.handleError(res))) 109 .pipe(catchError(res => this.restExtractor.handleError(res)))
103 } 110 }
111
112 buildFollowsListFilters (): AdvancedInputFilter[] {
113 return [
114 {
115 title: $localize`Advanced filters`,
116 children: [
117 {
118 value: 'state:accepted',
119 label: $localize`Accepted follows`
120 },
121 {
122 value: 'state:rejected',
123 label: $localize`Rejected follows`
124 },
125 {
126 value: 'state:pending',
127 label: $localize`Pending follows`
128 }
129 ]
130 }
131 ]
132 }
133
134 private parseFollowsListFilters (search: string) {
135 return this.restService.parseQueryStringFilter(search, {
136 state: {
137 prefix: 'state:'
138 }
139 })
140 }
104} 141}