mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
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:
parent
a7b703c589
commit
af6b4443a1
|
@ -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
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue