Merge "In LinkTargetInputWidget, put existence status into LinkCache"

This commit is contained in:
jenkins-bot 2014-08-28 22:17:03 +00:00 committed by Gerrit Code Review
commit f79d099490

View file

@ -142,16 +142,20 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function (
matchingPages = [],
disambigPages = [],
redirectPages = [],
titleObj = mw.Title.newFromText( this.value );
titleObj = mw.Title.newFromText( this.value ),
linkCacheUpdate = {};
for ( index in data ) {
matchingPage = data[index];
linkCacheUpdate[matchingPage.title] = { missing: false, redirect: false, disambiguation: false };
existingPages.push( matchingPage.title );
if ( matchingPage.redirect !== undefined ) {
redirectPages.push( matchingPage.title );
linkCacheUpdate[matchingPage.title].redirect = true;
} else if ( matchingPage.pageprops !== undefined && matchingPage.pageprops.disambiguation !== undefined ) {
disambigPages.push( matchingPage.title );
linkCacheUpdate[matchingPage.title].disambiguation = true;
} else {
matchingPages.push( matchingPage.title );
}
@ -164,6 +168,12 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function (
titleObj && ve.indexOf( titleObj.getPrefixedText(), existingPages ) !== -1
);
if ( !pageExists ) {
linkCacheUpdate[this.value] = { missing: true, redirect: false, disambiguation: false };
}
ve.init.platform.linkCache.set( linkCacheUpdate );
// External link
if ( ve.init.platform.getExternalLinkUrlProtocolsRegExp().test( this.value ) ) {
items.push( new OO.ui.MenuSectionItemWidget(