From 556e11a9cbc40eb2b0aee53c50f6faa2417dcb70 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 15 Sep 2020 10:19:27 -0500 Subject: [PATCH] Skip importing empty accounts, fixes #424 --- app/soapbox/actions/importer/index.js | 4 ++++ app/soapbox/reducers/notifications.js | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/soapbox/actions/importer/index.js b/app/soapbox/actions/importer/index.js index 0736dd7ce..44de245cf 100644 --- a/app/soapbox/actions/importer/index.js +++ b/app/soapbox/actions/importer/index.js @@ -46,6 +46,8 @@ export function importFetchedAccounts(accounts) { const normalAccounts = []; function processAccount(account) { + if (!account.id) return; + pushUnique(normalAccounts, normalizeAccount(account)); if (account.moved) { @@ -69,6 +71,8 @@ export function importFetchedStatuses(statuses) { const polls = []; function processStatus(status) { + if (!status.account.id) return; + const normalOldStatus = getState().getIn(['statuses', status.id]); const expandSpoilers = getSettings(getState()).get('expandSpoilers'); diff --git a/app/soapbox/reducers/notifications.js b/app/soapbox/reducers/notifications.js index c4c97c73f..e121c4e82 100644 --- a/app/soapbox/reducers/notifications.js +++ b/app/soapbox/reducers/notifications.js @@ -61,8 +61,9 @@ const normalizeNotification = (state, notification) => { const expandNormalizedNotifications = (state, notifications, next) => { let items = ImmutableList(); - notifications.forEach((n, i) => { - items = items.set(i, notificationToMap(n)); + notifications.forEach((n) => { + if (!n.account.id) return; + items = items.push(notificationToMap(n)); }); return state.withMutations(mutable => {