MWLinkTargetInputWidget: Normalise value before matching

Don't suggest a "new page" (redlink) for values that are
strictly different but the same as a suggestion according
to mw.Title (e.g. input "foo" with an existing "Foo" page
should not suggest a redlink to inexistant page "foo").

Bug: 48476
Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd
This commit is contained in:
Timo Tijhof 2013-05-22 00:20:41 +02:00
parent 22bbba249e
commit 70694b2bbf

View file

@ -115,7 +115,11 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function (
}
// Internal link
if ( !pageExists && ( !matchingPages || matchingPages.indexOf( this.value ) === -1 ) ) {
if ( !pageExists && ( !matchingPages ||
// Run value through mw.Title to avoid treating a match as a mismatch where
// normalisation would make them matching (bug 48476)
matchingPages.indexOf( new mw.Title( this.value ).toString() ) === -1
) ) {
items.push( new ve.ui.MenuSectionItemWidget(
'newPage',
{ '$$': menu$$, 'label': ve.msg( 'visualeditor-linkinspector-suggest-new-page' ) }