Skip to content

Commit

Permalink
Merge commit from fork
Browse files Browse the repository at this point in the history
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
  • Loading branch information
oneiros and Gargron authored Sep 17, 2024
1 parent 6a233cb commit d8f9db5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/javascript/mastodon/reducers/accounts_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit d8f9db5

Please sign in to comment.