Fix profile look-up being too permissive in web UI

This commit is contained in:
Eugen Rochko 2024-08-26 09:18:59 +02:00
parent 97f6baf977
commit 51de6eb35f

View File

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