Merge branch 'skip-broken-notifications' into 'develop'

Notifications: skip importing notifications with a null status

See merge request soapbox-pub/soapbox-fe!806
This commit is contained in:
Alex Gleason 2021-10-19 23:28:57 +00:00
commit 7dd842f351
1 changed files with 17 additions and 2 deletions

View File

@ -57,8 +57,23 @@ const notificationToMap = notification => ImmutableMap({
chat_message: notification.chat_message, chat_message: notification.chat_message,
}); });
// https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/424 const isValid = notification => {
const isValid = notification => Boolean(notification.account.id); try {
// https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/424
if (!notification.account.id) {
return false;
}
// Mastodon can return mentions with a null status
if (notification.type === 'mention' && !notification.status.id) {
return false;
}
return true;
} catch {
return false;
}
};
// Count how many notifications appear after the given ID (for unread count) // Count how many notifications appear after the given ID (for unread count)
const countFuture = (notifications, lastId) => { const countFuture = (notifications, lastId) => {