diff --git a/app/soapbox/actions/importer/index.js b/app/soapbox/actions/importer/index.js index 4c8a98247..aee579695 100644 --- a/app/soapbox/actions/importer/index.js +++ b/app/soapbox/actions/importer/index.js @@ -13,12 +13,6 @@ export const STATUSES_IMPORT = 'STATUSES_IMPORT'; export const POLLS_IMPORT = 'POLLS_IMPORT'; export const ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP = 'ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP'; -function pushUnique(array, object) { - if (array.every(element => element.id !== object.id)) { - array.push(object); - } -} - export function importAccount(account) { return { type: ACCOUNT_IMPORT, account }; } @@ -49,7 +43,7 @@ export function importFetchedAccounts(accounts) { function processAccount(account) { if (!account.id) return; - pushUnique(normalAccounts, normalizeAccount(account)); + normalAccounts.push(normalizeAccount(account)); if (account.moved) { processAccount(account.moved); @@ -122,8 +116,8 @@ export function importFetchedStatuses(statuses) { const normalOldStatus = getState().getIn(['statuses', status.id]); const expandSpoilers = getSettings(getState()).get('expandSpoilers'); - pushUnique(normalStatuses, normalizeStatus(status, normalOldStatus, expandSpoilers)); - pushUnique(accounts, status.account); + normalStatuses.push(normalizeStatus(status, normalOldStatus, expandSpoilers)); + accounts.push(status.account); if (status.reblog && status.reblog.id) { processStatus(status.reblog); @@ -139,7 +133,7 @@ export function importFetchedStatuses(statuses) { } if (status.poll && status.poll.id) { - pushUnique(polls, normalizePoll(status.poll)); + polls.push(normalizePoll(status.poll)); } }