Notifications: skip importing notifications with a null status

sw-disable-appshell
Alex Gleason 2021-10-19 18:14:51 -05:00
rodzic 02de1af9fe
commit 3bb891adaa
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -57,8 +57,23 @@ const notificationToMap = notification => ImmutableMap({
chat_message: notification.chat_message,
});
// https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/424
const isValid = notification => Boolean(notification.account.id);
const isValid = notification => {
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)
const countFuture = (notifications, lastId) => {