From 7e76cc380040e40a2292a9dc825f037c9b538030 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Oct 2021 15:22:15 +0200 Subject: [PATCH] Add quick filter for followers --- .../my-follows/my-followers.component.html | 2 +- .../+my-library/my-follows/my-followers.component.ts | 12 ++++++++++++ .../shared-forms/advanced-input-filter.component.ts | 2 +- 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 @@
- +
No follower found.
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' 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() 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 () { 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 { } hasFilters () { - return this.filters.length !== 0 + return this.filters && this.filters.length !== 0 } private scheduleSearchUpdate (value: string) { -- 2.41.0