about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/reducers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-21 10:06:03 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-10-28 19:24:02 +0200
commitf9f0949bd322bde741f81707ff871715c35d90e0 (patch)
tree087bbd428d5bb8b959f4b24aeb90f8646392070e /app/javascript/flavours/glitch/reducers
parent5f4f37f4325b3777d500dcfdcce80f6afb1a67f0 (diff)
[Glitch] Fix case-sensitive look-up for profiles in web UI
Port 5e908c5a95a64a4d48e35516723955ac61a15c4d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/reducers')
-rw-r--r--app/javascript/flavours/glitch/reducers/accounts_map.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/reducers/accounts_map.js b/app/javascript/flavours/glitch/reducers/accounts_map.js
index e0d42e9cd..53e08c8fb 100644
--- a/app/javascript/flavours/glitch/reducers/accounts_map.js
+++ b/app/javascript/flavours/glitch/reducers/accounts_map.js
@@ -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;
   }