Merge commit from fork

Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
This commit is contained in:
David Roetzel 2024-09-17 16:59:29 +02:00 committed by GitHub
parent 6a233cbfcf
commit d8f9db547a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,11 +4,10 @@ import { ACCOUNT_LOOKUP_FAIL } from '../actions/accounts';
import { importAccounts } from '../actions/accounts_typed'; import { importAccounts } from '../actions/accounts_typed';
import { domain } from '../initial_state'; import { domain } from '../initial_state';
export const normalizeForLookup = str => { const pattern = new RegExp(`@${domain}$`, 'gi');
str = str.toLowerCase();
const trailingIndex = str.indexOf(`@${domain.toLowerCase()}`); export const normalizeForLookup = str =>
return (trailingIndex > 0) ? str.slice(0, trailingIndex) : str; str.toLowerCase().replace(pattern, '');
};
const initialState = ImmutableMap(); const initialState = ImmutableMap();