aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-19 15:22:15 +0200
committerChocobozzz <me@florianbigard.com>2021-10-20 09:25:44 +0200
commit7e76cc380040e40a2292a9dc825f037c9b538030 (patch)
treeb429864cb2ef27c98b93c98cf09264be4a9d4868
parent906f46d0849fac3e2b30b7bdd57759e189d6a35d (diff)
downloadPeerTube-7e76cc380040e40a2292a9dc825f037c9b538030.tar.gz
PeerTube-7e76cc380040e40a2292a9dc825f037c9b538030.tar.zst
PeerTube-7e76cc380040e40a2292a9dc825f037c9b538030.zip
Add quick filter for followers
-rw-r--r--client/src/app/+my-library/my-follows/my-followers.component.html2
-rw-r--r--client/src/app/+my-library/my-follows/my-followers.component.ts12
-rw-r--r--client/src/app/shared/shared-forms/advanced-input-filter.component.ts2
3 files changed, 14 insertions, 2 deletions
diff --git a/client/src/app/+my-library/my-follows/my-followers.component.html b/client/src/app/+my-library/my-follows/my-followers.component.html
index d2b2dccb6..eac750c86 100644
--- a/client/src/app/+my-library/my-follows/my-followers.component.html
+++ b/client/src/app/+my-library/my-follows/my-followers.component.html
@@ -7,7 +7,7 @@
7</h1> 7</h1>
8 8
9<div class="followers-header"> 9<div class="followers-header">
10 <my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter> 10 <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)"></my-advanced-input-filter>
11</div> 11</div>
12 12
13<div class="no-results" i18n *ngIf="pagination.totalItems === 0">No follower found.</div> 13<div class="no-results" i18n *ngIf="pagination.totalItems === 0">No follower found.</div>
diff --git a/client/src/app/+my-library/my-follows/my-followers.component.ts b/client/src/app/+my-library/my-follows/my-followers.component.ts
index a7bbe6d99..413d524df 100644
--- a/client/src/app/+my-library/my-follows/my-followers.component.ts
+++ b/client/src/app/+my-library/my-follows/my-followers.component.ts
@@ -2,6 +2,7 @@ import { Subject } from 'rxjs'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute } from '@angular/router' 3import { ActivatedRoute } from '@angular/router'
4import { AuthService, ComponentPagination, Notifier } from '@app/core' 4import { AuthService, ComponentPagination, Notifier } from '@app/core'
5import { AdvancedInputFilter } from '@app/shared/shared-forms'
5import { UserSubscriptionService } from '@app/shared/shared-user-subscription' 6import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
6import { ActorFollow } from '@shared/models' 7import { ActorFollow } from '@shared/models'
7 8
@@ -21,6 +22,8 @@ export class MyFollowersComponent implements OnInit {
21 onDataSubject = new Subject<any[]>() 22 onDataSubject = new Subject<any[]>()
22 search: string 23 search: string
23 24
25 inputFilters: AdvancedInputFilter[]
26
24 constructor ( 27 constructor (
25 private route: ActivatedRoute, 28 private route: ActivatedRoute,
26 private auth: AuthService, 29 private auth: AuthService,
@@ -32,6 +35,15 @@ export class MyFollowersComponent implements OnInit {
32 if (this.route.snapshot.queryParams['search']) { 35 if (this.route.snapshot.queryParams['search']) {
33 this.search = this.route.snapshot.queryParams['search'] 36 this.search = this.route.snapshot.queryParams['search']
34 } 37 }
38
39 this.auth.userInformationLoaded.subscribe(() => {
40 this.inputFilters = this.auth.getUser().videoChannels.map(c => {
41 return {
42 queryParams: { search: 'channel:' + c.name },
43 label: $localize`Followers of ${c.name}`
44 }
45 })
46 })
35 } 47 }
36 48
37 onNearOfBottom () { 49 onNearOfBottom () {
diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts
index 113219f48..8315662b4 100644
--- a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts
+++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts
@@ -55,7 +55,7 @@ export class AdvancedInputFilterComponent implements OnInit, AfterViewInit {
55 } 55 }
56 56
57 hasFilters () { 57 hasFilters () {
58 return this.filters.length !== 0 58 return this.filters && this.filters.length !== 0
59 } 59 }
60 60
61 private scheduleSearchUpdate (value: string) { 61 private scheduleSearchUpdate (value: string) {