MWUsernameCompletionAction: Fix text for exact match

This broke when we introduced matching to display names.

Bug: T344399
Change-Id: I30512e09edafe0e7e170a17a9a02446c71650d0b
This commit is contained in:
Ed Sanders 2023-08-17 12:49:15 +01:00
parent a7b703c589
commit af6b4443a1

View file

@ -180,13 +180,14 @@ MWUsernameCompletionAction.prototype.getSuggestions = function ( input ) {
* @inheritdoc * @inheritdoc
*/ */
MWUsernameCompletionAction.prototype.compareSuggestionToInput = function ( suggestion, normalizedInput ) { MWUsernameCompletionAction.prototype.compareSuggestionToInput = function ( suggestion, normalizedInput ) {
var normalizedSuggestion = suggestion.username.toLowerCase() + ' ' + var normalizedSuggestion = suggestion.username.toLowerCase(),
normalizedSearchIndex = normalizedSuggestion + ' ' +
suggestion.displayNames.map( function ( displayName ) { suggestion.displayNames.map( function ( displayName ) {
return displayName.toLowerCase(); return displayName.toLowerCase();
} ).join( ' ' ); } ).join( ' ' );
return { return {
isMatch: normalizedSuggestion.indexOf( normalizedInput ) !== -1, isMatch: normalizedSearchIndex.indexOf( normalizedInput ) !== -1,
isExact: normalizedSuggestion === normalizedInput isExact: normalizedSuggestion === normalizedInput
}; };
}; };