removing muted/blocked from timelines
This commit is contained in:
parent
dac2cbfabd
commit
84fe025f47
|
@ -288,6 +288,10 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
|||
this.toolsService.findAccount(acc, this.fullHandle)
|
||||
.then((target: Account) => {
|
||||
this.mastodonService.mute(acc, target.id);
|
||||
return target;
|
||||
})
|
||||
.then((target: Account) => {
|
||||
this.notificationService.hideAccount(target);
|
||||
})
|
||||
.catch(err => {
|
||||
this.notificationService.notifyHttpError(err);
|
||||
|
@ -302,6 +306,10 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
|||
this.toolsService.findAccount(acc, this.fullHandle)
|
||||
.then((target: Account) => {
|
||||
this.mastodonService.block(acc, target.id);
|
||||
return target;
|
||||
})
|
||||
.then((target: Account) => {
|
||||
this.notificationService.hideAccount(target);
|
||||
})
|
||||
.catch(err => {
|
||||
this.notificationService.notifyHttpError(err);
|
||||
|
|
|
@ -59,6 +59,7 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
|||
|
||||
private goToTopSubscription: Subscription;
|
||||
private streamsSubscription: Subscription;
|
||||
private hideAccountSubscription: Subscription;
|
||||
private streams$: Observable<StreamElement[]>;
|
||||
|
||||
constructor(
|
||||
|
@ -78,18 +79,39 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.streamsSubscription = this.streams$.subscribe((streams: StreamElement[]) => {
|
||||
let updatedStream = streams.find(x => x.id === this.streamElement.id);
|
||||
|
||||
|
||||
if (this.hideBoosts !== updatedStream.hideBoosts
|
||||
|| this.hideBots !== updatedStream.hideBots
|
||||
|| this.hideReplies !== updatedStream.hideReplies) {
|
||||
this.streamElement = updatedStream;
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
||||
this.bufferStream = this.bufferStream.filter(x => {
|
||||
if(x.reblog){
|
||||
return x.reblog.account.url != accountUrl;
|
||||
} else {
|
||||
return x.account.url != accountUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.goToTopSubscription) this.goToTopSubscription.unsubscribe();
|
||||
if (this.streamsSubscription) this.streamsSubscription.unsubscribe();
|
||||
if (this.hideAccountSubscription) this.hideAccountSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
refresh(): any {
|
||||
|
|
|
@ -2,12 +2,13 @@ import { Injectable } from '@angular/core';
|
|||
import { Subject } from 'rxjs';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { StatusWrapper } from '../models/common.model';
|
||||
import { Status } from './models/mastodon.interfaces';
|
||||
import { Account } from './models/mastodon.interfaces';
|
||||
|
||||
@Injectable()
|
||||
export class NotificationService {
|
||||
public notifactionStream = new Subject<NotificatioData>();
|
||||
public newRespondPostedStream = new Subject<NewReplyData>();
|
||||
public hideAccountUrlStream = new Subject<string>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
@ -31,6 +32,10 @@ export class NotificationService {
|
|||
const notification = new NewReplyData(uiStatusRepliedToId, response);
|
||||
this.newRespondPostedStream.next(notification);
|
||||
}
|
||||
|
||||
public hideAccount(account: Account){
|
||||
this.hideAccountUrlStream.next(account.url);
|
||||
}
|
||||
}
|
||||
|
||||
export class NotificatioData {
|
||||
|
|
Loading…
Reference in New Issue