From bdd6a1b1f3db3ee503932d8ac839d0ab4b202546 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 3 Jul 2019 20:12:10 -0400 Subject: [PATCH] hide muted/blocked accounts in thread --- .../stream/thread/thread.component.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app/components/stream/thread/thread.component.ts b/src/app/components/stream/thread/thread.component.ts index b09bedc4..3764be3f 100644 --- a/src/app/components/stream/thread/thread.component.ts +++ b/src/app/components/stream/thread/thread.component.ts @@ -39,6 +39,7 @@ export class ThreadComponent implements OnInit, OnDestroy { @ViewChildren(StatusComponent) statusChildren: QueryList; private newPostSub: Subscription; + private hideAccountSubscription: Subscription; constructor( private readonly notificationService: NotificationService, @@ -69,12 +70,23 @@ export class ThreadComponent implements OnInit, OnDestroy { } } }); + + this.hideAccountSubscription = this.notificationService.hideAccountUrlStream.subscribe((accountUrl: string) => { + if (accountUrl) { + this.statuses = this.statuses.filter(x => { + if(x.status.reblog){ + return x.status.reblog.account.url != accountUrl; + } else { + return x.status.account.url != accountUrl; + } + }); + } + }); } ngOnDestroy(): void { - if (this.newPostSub) { - this.newPostSub.unsubscribe(); - } + if (this.newPostSub) this.newPostSub.unsubscribe(); + if (this.hideAccountSubscription) this.hideAccountSubscription.unsubscribe(); } private getThread(openThreadEvent: OpenThreadEvent) {