From d4e2c55cfc651862244d5eb167c769a47c819a91 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Thu, 25 Jun 2015 20:10:40 +0100 Subject: [PATCH] Get rid of Category: prefix when looking up categories from the API Bug: T103777 Change-Id: I27a81d832e3da7a0177d1c69af605c0525415b6b --- modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js index 5eee3d94bd..8c11604989 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js @@ -56,11 +56,17 @@ OO.mixinClass( ve.ui.MWCategoryInputWidget, OO.ui.mixin.LookupElement ); * @inheritdoc */ ve.ui.MWCategoryInputWidget.prototype.getLookupRequest = function () { + var title = mw.Title.newFromText( this.value ); + if ( title && title.getNamespaceId() === mw.config.get( 'wgNamespaceIds' ).category ) { + title = title.getMainText(); + } else { + title = this.value; + } return new mw.Api().get( { action: 'query', generator: 'allcategories', gacmin: 1, - gacprefix: this.value, + gacprefix: title, prop: 'categoryinfo', redirects: '' } );