diff --git a/src/app/components/stream/stream-notifications/stream-notifications.component.ts b/src/app/components/stream/stream-notifications/stream-notifications.component.ts index c79b4ed2..d21186f7 100644 --- a/src/app/components/stream/stream-notifications/stream-notifications.component.ts +++ b/src/app/components/stream/stream-notifications/stream-notifications.component.ts @@ -122,7 +122,7 @@ export class StreamNotificationsComponent extends BrowseBase { loadNotifications(): any { this.account = this.toolsService.getAccountById(this.streamElement.accountId); - this.mentionsSubscription = this.userNotificationService.userNotifications.subscribe((userNotifications: UserNotification[]) => { + this.mentionsSubscription = this.userNotificationService.userNotifications.subscribe((userNotifications: UserNotification[]) => { this.loadMentions(userNotifications); }); @@ -130,10 +130,13 @@ export class StreamNotificationsComponent extends BrowseBase { .then((notifications: Notification[]) => { this.isNotificationsLoading = false; - this.notifications = notifications.map(x => { + let wrappedNotification= notifications.map(x => { let cwPolicy = this.toolsService.checkContentWarning(x.status); return new NotificationWrapper(x, this.account, cwPolicy.applyCw, cwPolicy.hide); }); + + this.notifications = wrappedNotification.filter(x => x.type !== 'mention' || (x.type === 'mention' && x.status.status !== null)); + this.lastNotificationId = this.notifications[this.notifications.length - 1].notification.id; }) .catch(err => { diff --git a/src/app/services/user-notification.service.ts b/src/app/services/user-notification.service.ts index 6ca0fb9d..9f7701cf 100644 --- a/src/app/services/user-notification.service.ts +++ b/src/app/services/user-notification.service.ts @@ -60,6 +60,8 @@ export class UserNotificationService { private startFetchingNotifications(account: AccountInfo) { let getMentionsPromise = this.mastodonService.getNotifications(account, ['favourite', 'follow', 'reblog', 'poll', 'follow_request', 'move', 'update'], null, null, 10) .then((notifications: Notification[]) => { + notifications = notifications.filter(x => x.status !== null); + this.processMentionsAndNotifications(account, notifications, NotificationTypeEnum.UserMention); }) .catch(err => {