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
*/
MWUsernameCompletionAction.prototype.compareSuggestionToInput = function ( suggestion, normalizedInput ) {
var normalizedSuggestion = suggestion.username.toLowerCase() + ' ' +
var normalizedSuggestion = suggestion.username.toLowerCase(),
normalizedSearchIndex = normalizedSuggestion + ' ' +
suggestion.displayNames.map( function ( displayName ) {
return displayName.toLowerCase();
} ).join( ' ' );
return {
isMatch: normalizedSuggestion.indexOf( normalizedInput ) !== -1,
isMatch: normalizedSearchIndex.indexOf( normalizedInput ) !== -1,
isExact: normalizedSuggestion === normalizedInput
};
};