From 65ea097f1df5f14a4b389aa6ec0b955f2066b41c Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 2 Jan 2024 16:02:25 +0100 Subject: [PATCH] Fix loading local accounts with extraneous domain part in WebUI (#28559) --- app/javascript/mastodon/reducers/accounts_map.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/accounts_map.js b/app/javascript/mastodon/reducers/accounts_map.js index d5ecad7dbf..9053dcc9c0 100644 --- a/app/javascript/mastodon/reducers/accounts_map.js +++ b/app/javascript/mastodon/reducers/accounts_map.js @@ -2,8 +2,13 @@ import { Map as ImmutableMap } from 'immutable'; import { ACCOUNT_LOOKUP_FAIL } from '../actions/accounts'; import { importAccounts } from '../actions/accounts_typed'; +import { domain } from '../initial_state'; -export const normalizeForLookup = str => str.toLowerCase(); +export const normalizeForLookup = str => { + str = str.toLowerCase(); + const trailingIndex = str.indexOf(`@${domain.toLowerCase()}`); + return (trailingIndex > 0) ? str.slice(0, trailingIndex) : str; +}; const initialState = ImmutableMap();