]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add quick filter for followers
authorChocobozzz <me@florianbigard.com>
Tue, 19 Oct 2021 13:22:15 +0000 (15:22 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 20 Oct 2021 07:25:44 +0000 (09:25 +0200)
client/src/app/+my-library/my-follows/my-followers.component.html
client/src/app/+my-library/my-follows/my-followers.component.ts
client/src/app/shared/shared-forms/advanced-input-filter.component.ts

index d2b2dccb61b29d092e8b0d5da2a47119b055a87a..eac750c865608013c50e4fdf47242b63e07ff9bd 100644 (file)
@@ -7,7 +7,7 @@
 </h1>
 
 <div class="followers-header">
-  <my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter>
+  <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)"></my-advanced-input-filter>
 </div>
 
 <div class="no-results" i18n *ngIf="pagination.totalItems === 0">No follower found.</div>
index a7bbe6d99251c4caf2700bfd4b14fc45da6974d1..413d524dfcf44c0a295ca56adaa4ee6bad9388ae 100644 (file)
@@ -2,6 +2,7 @@ import { Subject } from 'rxjs'
 import { Component, OnInit } from '@angular/core'
 import { ActivatedRoute } from '@angular/router'
 import { AuthService, ComponentPagination, Notifier } from '@app/core'
+import { AdvancedInputFilter } from '@app/shared/shared-forms'
 import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
 import { ActorFollow } from '@shared/models'
 
@@ -21,6 +22,8 @@ export class MyFollowersComponent implements OnInit {
   onDataSubject = new Subject<any[]>()
   search: string
 
+  inputFilters: AdvancedInputFilter[]
+
   constructor (
     private route: ActivatedRoute,
     private auth: AuthService,
@@ -32,6 +35,15 @@ export class MyFollowersComponent implements OnInit {
     if (this.route.snapshot.queryParams['search']) {
       this.search = this.route.snapshot.queryParams['search']
     }
+
+    this.auth.userInformationLoaded.subscribe(() => {
+      this.inputFilters = this.auth.getUser().videoChannels.map(c => {
+        return {
+          queryParams: { search: 'channel:' + c.name },
+          label: $localize`Followers of ${c.name}`
+        }
+      })
+    })
   }
 
   onNearOfBottom () {
index 113219f48e8eb74fcef45781fe155fe41e7f382f..8315662b46b32a42885c40a28dd7ca7f98ebb3e0 100644 (file)
@@ -55,7 +55,7 @@ export class AdvancedInputFilterComponent implements OnInit, AfterViewInit {
   }
 
   hasFilters () {
-    return this.filters.length !== 0
+    return this.filters && this.filters.length !== 0
   }
 
   private scheduleSearchUpdate (value: string) {