sforkowany z mirror/soapbox
rodzic
391d4158af
commit
bc7f72a691
|
@ -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');
|
||||
|
|
Ładowanie…
Reference in New Issue