Get rid of Category: prefix when looking up categories from the API

Bug: T103777
Change-Id: I27a81d832e3da7a0177d1c69af605c0525415b6b
This commit is contained in:
Alex Monk 2015-06-25 20:10:40 +01:00
parent 4f2b052fc2
commit d4e2c55cfc

View file

@ -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: ''
} );