fix error spamming, fix #605

This commit is contained in:
Nicolas Constant 2024-03-09 01:46:26 -05:00
parent 12ce0a3a4a
commit 92ec089eab
2 changed files with 7 additions and 2 deletions

View File

@ -130,10 +130,13 @@ export class StreamNotificationsComponent extends BrowseBase {
.then((notifications: Notification[]) => { .then((notifications: Notification[]) => {
this.isNotificationsLoading = false; this.isNotificationsLoading = false;
this.notifications = notifications.map(x => { let wrappedNotification= notifications.map(x => {
let cwPolicy = this.toolsService.checkContentWarning(x.status); let cwPolicy = this.toolsService.checkContentWarning(x.status);
return new NotificationWrapper(x, this.account, cwPolicy.applyCw, cwPolicy.hide); 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; this.lastNotificationId = this.notifications[this.notifications.length - 1].notification.id;
}) })
.catch(err => { .catch(err => {

View File

@ -60,6 +60,8 @@ export class UserNotificationService {
private startFetchingNotifications(account: AccountInfo) { private startFetchingNotifications(account: AccountInfo) {
let getMentionsPromise = this.mastodonService.getNotifications(account, ['favourite', 'follow', 'reblog', 'poll', 'follow_request', 'move', 'update'], null, null, 10) let getMentionsPromise = this.mastodonService.getNotifications(account, ['favourite', 'follow', 'reblog', 'poll', 'follow_request', 'move', 'update'], null, null, 10)
.then((notifications: Notification[]) => { .then((notifications: Notification[]) => {
notifications = notifications.filter(x => x.status !== null);
this.processMentionsAndNotifications(account, notifications, NotificationTypeEnum.UserMention); this.processMentionsAndNotifications(account, notifications, NotificationTypeEnum.UserMention);
}) })
.catch(err => { .catch(err => {