Importer: remove the extremely stupid pushUnique function
This commit is contained in:
parent
93e7efba05
commit
aebc653bd9
1 changed files with 4 additions and 10 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue