Fix up mw.libs.ve.EditingTabDialog.prototype.getActionProcess

How did this ever work?

Ensure action is passed through and not just undefined, wait for change to go
through before refreshing.

Bug: T131818
Change-Id: I83b5695906044299d338e62e6c980c596d291765
This commit is contained in:
Alex Monk 2016-04-04 17:33:40 +01:00
parent 1ad77ddf91
commit f67b578c3f

View file

@ -71,11 +71,19 @@ mw.libs.ve.EditingTabDialog.prototype.getSetupProcess = function ( action ) {
* @inheritdoc
*/
mw.libs.ve.EditingTabDialog.prototype.getActionProcess = function ( action ) {
if ( action ) {
var dialog = this,
act = action;
if ( act ) {
return new OO.ui.Process( function () {
new mw.Api().saveOption( 'visualeditor-tabs', action );
mw.user.options.set( 'visualeditor-tabs', action );
this.close( { action: action } );
var action = this.getActions().get( { actions: act } )[ 0 ];
action.pushPending();
dialog.pushPending();
new mw.Api().saveOption( 'visualeditor-tabs', act ).done( function () {
action.popPending();
mw.user.options.set( 'visualeditor-tabs', act );
dialog.close( { action: act } );
} );
}, this );
} else {
// Parent method