diff --git a/app/soapbox/actions/importer/index.js b/app/soapbox/actions/importer/index.js index 44de245cf..98d0a8d36 100644 --- a/app/soapbox/actions/importer/index.js +++ b/app/soapbox/actions/importer/index.js @@ -64,6 +64,22 @@ export function importFetchedStatus(status) { return importFetchedStatuses([status]); } +// Sometimes Pleroma can return an empty account, +// or a repost can appear of a deleted account. Skip these statuses. +const isBroken = status => { + try { + // Skip empty accounts + // https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/424 + if (!status.account.id) return true; + // Skip broken reposts + // https://gitlab.com/soapbox-pub/soapbox/-/issues/28 + if (status.reblog && !status.reblog.account.id) return true; + return false; + } catch(e) { + return true; + } +}; + export function importFetchedStatuses(statuses) { return (dispatch, getState) => { const accounts = []; @@ -71,7 +87,8 @@ export function importFetchedStatuses(statuses) { const polls = []; function processStatus(status) { - if (!status.account.id) return; + // Skip broken statuses + if (isBroken(status)) return; const normalOldStatus = getState().getIn(['statuses', status.id]); const expandSpoilers = getSettings(getState()).get('expandSpoilers');