Merge "API: Use formatversion=2 by default"

This commit is contained in:
jenkins-bot 2019-04-30 19:30:21 +00:00 committed by Gerrit Code Review
commit cd70d287de
6 changed files with 11 additions and 8 deletions

View file

@ -303,7 +303,6 @@
titles: titles,
lang: mw.config.get( 'wgUserLanguage' ),
format: 'json',
formatversion: '2',
doNotIgnoreMissingTitles: '1',
redirects: '1'
} ).done( this.fetchRequestDone.bind( this, titles, specs ) );

View file

@ -217,7 +217,8 @@
uselang: mw.config.get( 'wgUserLanguage' ),
editintro: uri.query.editintro,
preload: options.preload,
preloadparams: options.preloadparams
preloadparams: options.preloadparams,
formatversion: 2
};
// Only request the API to explicitly load the currently visible revision if we're restoring
@ -375,7 +376,8 @@
uselang: mw.config.get( 'wgUserLanguage' ),
editintro: uri.query.editintro,
preload: options.preload,
preloadparams: options.preloadparams
preloadparams: options.preloadparams,
formatversion: 2
};
// section should never really be undefined, but check just in case

View file

@ -658,6 +658,8 @@ ve.init.mw.Target.prototype.getPageName = function () {
* @return {mw.Api} API object
*/
ve.init.mw.Target.prototype.getContentApi = function ( doc, options ) {
options = options || {};
options.parameters = ve.extendObject( { formatversion: 2 }, options.parameters );
return new mw.Api( options );
};
@ -671,5 +673,7 @@ ve.init.mw.Target.prototype.getContentApi = function ( doc, options ) {
* @return {mw.Api} API object
*/
ve.init.mw.Target.prototype.getLocalApi = function ( options ) {
options = options || {};
options.parameters = ve.extendObject( { formatversion: 2 }, options.parameters );
return new mw.Api( options );
};

View file

@ -169,7 +169,6 @@ ve.ui.MWLanguagesPage.prototype.getAllLanguageItems = function () {
// TODO: Detect paging token if results exceed limit
ve.init.target.getContentApi().get( {
format: 'json',
formatversion: 2,
action: 'query',
prop: 'langlinks',
llprop: 'autonym',

View file

@ -106,14 +106,13 @@ ve.ui.MWEditSummaryWidget.prototype.getSummaries = function () {
if ( mw.user.isAnon() ) {
this.getSummariesPromise = $.Deferred().resolve( [] ).promise();
} else {
this.getSummariesPromise = new mw.Api().get( {
this.getSummariesPromise = ve.init.target.getLocalApi().get( {
action: 'query',
list: 'usercontribs',
ucuser: mw.user.getName(),
ucprop: 'comment|title',
uclimit: 500,
format: 'json',
formatversion: 2
format: 'json'
} ).then( function ( response ) {
var usedComments = {},
changes = ve.getProp( response, 'query', 'usercontribs' ) || [];

View file

@ -105,7 +105,7 @@ ve.ui.MWTemplateTitleInputWidget.prototype.getLookupRequest = function () {
xhr = widget.getApi().get( {
action: 'templatedata',
format: 'json',
formatversion: '2',
formatversion: 2,
titles: titles,
redirects: !!widget.showRedirects,
doNotIgnoreMissingTitles: '1',