Fix case-sensitive look-up for profiles in web UI (#19397)
This commit is contained in:
parent
23d367f544
commit
5e908c5a95
2 changed files with 6 additions and 3 deletions
|
@ -1,14 +1,16 @@
|
|||
import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from '../actions/importer';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
export const normalizeForLookup = str => str.toLowerCase();
|
||||
|
||||
const initialState = ImmutableMap();
|
||||
|
||||
export default function accountsMap(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case ACCOUNT_IMPORT:
|
||||
return state.set(action.account.acct, action.account.id);
|
||||
return state.set(normalizeForLookup(action.account.acct), action.account.id);
|
||||
case ACCOUNTS_IMPORT:
|
||||
return state.withMutations(map => action.accounts.forEach(account => map.set(account.acct, account.id)));
|
||||
return state.withMutations(map => action.accounts.forEach(account => map.set(normalizeForLookup(account.acct), account.id)));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue