mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Delete last template search result, not a random one
Because the API uses a generator, the search results are ordered alphabetically. The actual search result ranking is in a .index field. This code accidentially deleted the alphabetically lowest template instead of the least relevant one. Change-Id: I79de024feb569e9f06bedab908a6509a4d4fa99b
This commit is contained in:
parent
ba1718ea11
commit
12dca65912
|
@ -235,7 +235,9 @@ ve.ui.MWTemplateTitleInputWidget.prototype.addExactMatch = function ( response )
|
|||
newPage.index = 1;
|
||||
pages.unshift( newPage );
|
||||
if ( pages.length > widget.limit ) {
|
||||
pages.splice( widget.limit );
|
||||
pages.sort( function ( a, b ) {
|
||||
return a.index - b.index;
|
||||
} ).splice( widget.limit );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue