[Glitch] Fix case-sensitive look-up for profiles in web UI
Port e700e95246
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
parent
1f9f465931
commit
a916c471d1
|
@ -17,11 +17,12 @@ import MissingIndicator from 'flavours/glitch/components/missing_indicator';
|
|||
import TimelineHint from 'flavours/glitch/components/timeline_hint';
|
||||
import LimitedAccountHint from './components/limited_account_hint';
|
||||
import { getAccountHidden } from 'flavours/glitch/selectors';
|
||||
import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map';
|
||||
|
||||
const emptyList = ImmutableList();
|
||||
|
||||
const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) => {
|
||||
const accountId = id || state.getIn(['accounts_map', acct]);
|
||||
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);
|
||||
|
||||
if (!accountId) {
|
||||
return {
|
||||
|
|
|
@ -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…
Reference in New Issue