mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Always use API formatversion: 2
Change-Id: Icb14766488beab76e24d1fedcc4b6214c6b04d98
This commit is contained in:
parent
94bbaa846f
commit
0cfc84aa29
|
@ -1,4 +1,5 @@
|
|||
var
|
||||
api = new mw.Api( { formatversion: 2 } ),
|
||||
controller = require( './controller.js' ),
|
||||
modifier = require( './modifier.js' ),
|
||||
parser = require( './parser.js' ),
|
||||
|
@ -60,13 +61,12 @@ OO.initClass( CommentController );
|
|||
* @return {jQuery.Promise}
|
||||
*/
|
||||
function getLatestRevId( pageName ) {
|
||||
return ( new mw.Api() ).get( {
|
||||
return api.get( {
|
||||
action: 'query',
|
||||
prop: 'revisions',
|
||||
rvprop: 'ids',
|
||||
rvlimit: 1,
|
||||
titles: pageName,
|
||||
formatversion: 2
|
||||
titles: pageName
|
||||
} ).then( function ( resp ) {
|
||||
return resp.query.pages[ 0 ].revisions[ 0 ].revid;
|
||||
} );
|
||||
|
@ -170,7 +170,7 @@ CommentController.prototype.setup = function ( mode ) {
|
|||
commentController.teardown();
|
||||
|
||||
OO.ui.alert(
|
||||
code instanceof Error ? code.toString() : ( new mw.Api() ).getErrorMessage( data ),
|
||||
code instanceof Error ? code.toString() : api.getErrorMessage( data ),
|
||||
{ size: 'medium' }
|
||||
);
|
||||
|
||||
|
@ -374,7 +374,7 @@ CommentController.prototype.save = function ( parsoidData ) {
|
|||
{
|
||||
// No timeout. Huge talk pages take a long time to save, and falsely reporting an error can
|
||||
// result in duplicate messages when the user retries. (T249071)
|
||||
api: new mw.Api( { ajax: { timeout: 0 } } )
|
||||
api: new mw.Api( { ajax: { timeout: 0 }, formatversion: 2 } )
|
||||
}
|
||||
).catch( function ( code, data ) {
|
||||
// Handle edit conflicts. Load the latest revision of the page, then try again. If the parent
|
||||
|
@ -459,7 +459,7 @@ CommentController.prototype.switchToVisual = function () {
|
|||
} ).join( '\n' );
|
||||
|
||||
// Based on ve.init.mw.Target#parseWikitextFragment
|
||||
parsePromise = ( new mw.Api() ).post( {
|
||||
parsePromise = api.post( {
|
||||
action: 'visualeditor',
|
||||
paction: 'parsefragment',
|
||||
page: pageData.pageName,
|
||||
|
|
|
@ -90,7 +90,7 @@ function ReplyWidget( commentController, parsoidData, config ) {
|
|||
this.beforeUnloadHandler = this.onBeforeUnload.bind( this );
|
||||
this.unloadHandler = this.onUnload.bind( this );
|
||||
|
||||
this.api = new mw.Api();
|
||||
this.api = new mw.Api( { formatversion: 2 } );
|
||||
this.onInputChangeThrottled = OO.ui.throttle( this.onInputChange.bind( this ), 1000 );
|
||||
|
||||
// Initialization
|
||||
|
@ -367,7 +367,6 @@ ReplyWidget.prototype.preparePreview = function ( wikitext ) {
|
|||
wikitext = wikitext.slice( 0, -4 ) + '<span style="opacity: 0.6;">~~~~</span>';
|
||||
wikitext = indent + wikitext.replace( /\n/g, '\n' + indent );
|
||||
this.previewRequest = parsePromise = this.api.post( {
|
||||
formatversion: 2,
|
||||
action: 'parse',
|
||||
text: wikitext,
|
||||
pst: true,
|
||||
|
|
|
@ -20,7 +20,7 @@ function MWUsernameCompletionAction( surface ) {
|
|||
// Parent constructor
|
||||
MWUsernameCompletionAction.super.call( this, surface );
|
||||
|
||||
this.api = new mw.Api();
|
||||
this.api = new mw.Api( { formatversion: 2 } );
|
||||
this.searchedPrefixes = {};
|
||||
this.localUsers = [];
|
||||
this.ipUsers = [];
|
||||
|
|
Loading…
Reference in a new issue