Add quick filter for followers
This commit is contained in:
parent
906f46d084
commit
7e76cc3800
|
@ -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>
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue