Don't call fromJS in some reducers

This commit is contained in:
Alex Gleason 2022-03-16 21:52:20 -05:00
parent 8167b72762
commit f1a286f5e0
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ const minifyAccount = account => {
};
const fixAccount = (state, account) => {
const normalized = minifyAccount(normalizeAccount(fromJS(account)));
const normalized = minifyAccount(normalizeAccount(account));
return state.set(account.id, normalized);
};
@ -119,7 +119,7 @@ const removePermission = (state, accountIds, permissionGroup) => {
});
};
const buildAccount = adminUser => normalizeAccount(fromJS({
const buildAccount = adminUser => normalizeAccount({
id: adminUser.get('id'),
username: adminUser.get('nickname').split('@')[0],
acct: adminUser.get('nickname'),
@ -142,7 +142,7 @@ const buildAccount = adminUser => normalizeAccount(fromJS({
},
},
should_refetch: true,
}));
});
const mergeAdminUser = (account, adminUser) => {
return account.withMutations(account => {

View File

@ -1,4 +1,4 @@
import { Map as ImmutableMap, fromJS } from 'immutable';
import { Map as ImmutableMap } from 'immutable';
import { POLLS_IMPORT } from 'soapbox/actions/importer';
import { normalizeStatus } from 'soapbox/normalizers/status';
@ -6,7 +6,7 @@ import { normalizeStatus } from 'soapbox/normalizers/status';
// HOTFIX: Convert the poll into a fake status to normalize it...
// TODO: get rid of POLLS_IMPORT and use STATUS_IMPORT here.
const normalizePoll = poll => {
const status = fromJS({ poll });
const status = { poll };
return normalizeStatus(status).poll;
};