From c035073cf99427402ea45cb4e453e7969f44e4af Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 6 May 2019 14:57:51 -0500 Subject: [PATCH] Fix abandon edit warning message This message was upstreamed to core and later renamed. Use the upstreamed dialog itself when switching sections. Bug: T222525 Change-Id: Ibd2d75ec503e92b5ddec2105f762b0c9f0dc96fb --- extension.json | 1 + .../ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js | 2 +- modules/ve-mw/init/ve.init.mw.ArticleTarget.js | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extension.json b/extension.json index fa48c0e611..6050be926b 100644 --- a/extension.json +++ b/extension.json @@ -438,6 +438,7 @@ "creating", "editing", "lastmodifiedat", + "mw-widgets-abandonedit", "redirectpagesub", "subject", "visualeditor-loadwarning", diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index a6d9984eee..8189479cf5 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -1502,7 +1502,7 @@ ve.init.mw.DesktopArticleTarget.prototype.onBeforeUnload = function () { mw.user.options.get( 'useeditwarning' ) ) { // Return our message - return ve.msg( 'visualeditor-viewpage-savewarning' ); + return ve.msg( 'mw-widgets-abandonedit' ); } }; diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index fa33c50c38..e2f9432889 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -2404,7 +2404,10 @@ ve.init.mw.ArticleTarget.prototype.switchToWikitextSection = function ( section, return; } if ( !noConfirm && this.edited && mw.user.options.get( 'useeditwarning' ) ) { - promise = OO.ui.confirm( mw.msg( 'visualeditor-viewpage-savewarning' ) ); + promise = this.getSurface().dialogs.openWindow( 'abandonedit' ) + .closed.then( function ( data ) { + return data && data.action === 'discard'; + } ); } else { promise = $.Deferred().resolve( true ).promise(); }