diff --git a/lib/components/chat-mention-provider.react.js b/lib/components/chat-mention-provider.react.js --- a/lib/components/chat-mention-provider.react.js +++ b/lib/components/chat-mention-provider.react.js @@ -13,6 +13,7 @@ ThreadInfo, } from '../types/thread-types.js'; import { useResolvedThreadInfosObj } from '../utils/entity-helpers.js'; +import { getNameForThreadEntity } from '../utils/entity-text.js'; import { useSelector } from '../utils/redux-utils.js'; type Props = { @@ -245,14 +246,23 @@ uiName: chatMentionCandidatesObj[communityThreadID][threadID].threadInfo .uiName, + rawChatName: + chatMentionCandidatesObj[communityThreadID][threadID].rawChatName, }); } // Sort the keys so that the order of the search result is consistent searchIndexEntries.sort(({ uiName: uiNameA }, { uiName: uiNameB }) => uiNameA.localeCompare(uiNameB), ); - for (const { id, uiName } of searchIndexEntries) { - searchIndex.addEntry(id, uiName); + for (const { id, uiName, rawChatName } of searchIndexEntries) { + const names = [uiName]; + if (rawChatName) { + typeof rawChatName === 'string' + ? names.push(rawChatName) + : names.push(getNameForThreadEntity(rawChatName)); + } + + searchIndex.addEntry(id, names.join(' ')); } result[communityThreadID] = searchIndex; } diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js --- a/lib/utils/entity-text.js +++ b/lib/utils/entity-text.js @@ -585,6 +585,7 @@ ET, entityTextToRawString, entityTextToReact, + getNameForThreadEntity, pluralizeEntityText, useENSNamesForEntityText, useEntityTextAsString,