diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js --- a/lib/shared/mention-utils.js +++ b/lib/shared/mention-utils.js @@ -13,7 +13,7 @@ export type TypeaheadMatchedStrings = { +textBeforeAtSymbol: string, - +usernamePrefix: string, + +query: string, }; export type Selection = { diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js --- a/native/chat/chat-input-bar.react.js +++ b/native/chat/chat-input-bar.react.js @@ -552,14 +552,14 @@ if (typeaheadRegexMatches && !isEditMode) { const typeaheadMatchedStrings = { textBeforeAtSymbol: typeaheadRegexMatches[1] ?? '', - usernamePrefix: typeaheadRegexMatches[4] ?? '', + query: typeaheadRegexMatches[4] ?? '', }; const suggestedUsers = getTypeaheadUserSuggestions( this.props.userSearchIndex, this.props.mentionsCandidates, this.props.viewerID, - typeaheadMatchedStrings.usernamePrefix, + typeaheadMatchedStrings.query, ); if (suggestedUsers.length > 0) { diff --git a/native/chat/typeahead-tooltip.react.js b/native/chat/typeahead-tooltip.react.js --- a/native/chat/typeahead-tooltip.react.js +++ b/native/chat/typeahead-tooltip.react.js @@ -30,7 +30,7 @@ focusAndUpdateTextAndSelection, } = props; - const { textBeforeAtSymbol, usernamePrefix } = matchedStrings; + const { textBeforeAtSymbol, query } = matchedStrings; const styles = useStyles(unboundStyles); @@ -40,7 +40,7 @@ const { newText, newSelectionStart } = getNewTextAndSelection( textBeforeAtSymbol, text, - usernamePrefix, + query, item, ); @@ -64,7 +64,7 @@ styles.buttonLabel, textBeforeAtSymbol, text, - usernamePrefix, + query, focusAndUpdateTextAndSelection, ], ); diff --git a/web/chat/chat-input-bar.react.js b/web/chat/chat-input-bar.react.js --- a/web/chat/chat-input-bar.react.js +++ b/web/chat/chat-input-bar.react.js @@ -602,7 +602,7 @@ ? { textBeforeAtSymbol: typeaheadRegexMatches.groups?.textPrefix ?? '', - usernamePrefix: typeaheadRegexMatches.groups?.username ?? '', + query: typeaheadRegexMatches.groups?.username ?? '', } : null, [typeaheadRegexMatches], @@ -630,7 +630,7 @@ userSearchIndex, props.inputState.typeaheadState.frozenMentionsCandidates, viewerID, - typeaheadMatchedStrings.usernamePrefix, + typeaheadMatchedStrings.query, ); }, [ userSearchIndex, diff --git a/web/chat/typeahead-tooltip.react.js b/web/chat/typeahead-tooltip.react.js --- a/web/chat/typeahead-tooltip.react.js +++ b/web/chat/typeahead-tooltip.react.js @@ -26,7 +26,7 @@ function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node { const { inputState, textarea, matchedStrings, suggestedUsers } = props; - const { textBeforeAtSymbol, usernamePrefix } = matchedStrings; + const { textBeforeAtSymbol, query } = matchedStrings; const [isVisibleForAnimation, setIsVisibleForAnimation] = React.useState(false); @@ -63,7 +63,7 @@ inputStateSetTextCursorPosition: inputState.setTextCursorPosition, suggestedUsers, textBeforeAtSymbol, - usernamePrefix, + query, }), [ inputState.draft, @@ -71,7 +71,7 @@ inputState.setTextCursorPosition, suggestedUsers, textBeforeAtSymbol, - usernamePrefix, + query, ], ); diff --git a/web/utils/typeahead-utils.js b/web/utils/typeahead-utils.js --- a/web/utils/typeahead-utils.js +++ b/web/utils/typeahead-utils.js @@ -82,7 +82,7 @@ +inputStateSetTextCursorPosition: (newPosition: number) => mixed, +suggestedUsers: $ReadOnlyArray, +textBeforeAtSymbol: string, - +usernamePrefix: string, + +query: string, }; function getTypeaheadTooltipActions( @@ -94,7 +94,7 @@ inputStateSetTextCursorPosition, suggestedUsers, textBeforeAtSymbol, - usernamePrefix, + query, } = params; return suggestedUsers .filter( @@ -106,7 +106,7 @@ const { newText, newSelectionStart } = getNewTextAndSelection( textBeforeAtSymbol, inputStateDraft, - usernamePrefix, + query, suggestedUser, );