mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
Get rid of Category: prefix when looking up categories from the API
Bug: T103777 Change-Id: I27a81d832e3da7a0177d1c69af605c0525415b6b
This commit is contained in:
parent
4f2b052fc2
commit
d4e2c55cfc
|
@ -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: ''
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue