From 00fc98db4f9f12b1f2575eaaf1252b5adc39bba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 6 Jun 2017 20:40:40 +0200 Subject: [PATCH] Update for deprecation of OOjs UI openWindow/closeWindow promise Bug: T166729 Change-Id: I2ae5c13592539dd2a7cb98e0197ed2f891855d41 --- modules/ext.templateDataGenerator.target.js | 37 +++++++++------------ 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/modules/ext.templateDataGenerator.target.js b/modules/ext.templateDataGenerator.target.js index b5cdab91..a2dcb570 100644 --- a/modules/ext.templateDataGenerator.target.js +++ b/modules/ext.templateDataGenerator.target.js @@ -219,20 +219,16 @@ mw.TemplateData.Target.prototype.onEditOpenDialogButton = function () { flags: 'safe' } ] - } ).then( function ( opened ) { - return opened.then( function ( closing ) { - return closing.then( function ( data ) { - var model; - if ( data && data.action === 'accept' ) { - // Open the dialog with an empty model - model = mw.TemplateData.Model.static.newFromObject( - { params: {} }, - target.sourceHandler.getTemplateSourceCodeParams() - ); - target.openEditDialog( model ); - } - } ); - } ); + } ).closed.then( function ( data ) { + var model; + if ( data && data.action === 'accept' ) { + // Open the dialog with an empty model + model = mw.TemplateData.Model.static.newFromObject( + { params: {} }, + target.sourceHandler.getTemplateSourceCodeParams() + ); + target.openEditDialog( model ); + } } ); } ); @@ -312,14 +308,11 @@ mw.TemplateData.Target.prototype.onDialogApply = function ( templateData ) { label: mw.msg( 'templatedata-modal-button-apply' ) } ] - } ) - .then( function ( opening ) { return opening; } ) - .then( function ( opened ) { return opened; } ) - .then( function ( data ) { - if ( data && data.action === 'apply' ) { - target.setWikitext( target.replaceTemplateData( templateData ) ); - } - } ); + } ).closed.then( function ( data ) { + if ( data && data.action === 'apply' ) { + target.setWikitext( target.replaceTemplateData( templateData ) ); + } + } ); } };