From 37e349913ee336ed0ea317156c2e589090b5f799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 22 Jun 2018 01:06:01 +0200 Subject: [PATCH] If VE was opened on action=edit URL, redirect to view URL when closing We already do it after save, but not if the editor is closed without saving. This behavior is a bit awkward for non-existent pages (redlinks), since MediaWiki normally doesn't display them in view mode (all links point to action=edit). But this seems less weird than not allowing the editor to be closed. Bug: T122388 Bug: T168338 Change-Id: Id9ee41356f011dfbfa6e8744b8d9076f8eacaf39 --- .../ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 7a6fa89dec..89df50c8e1 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -675,6 +675,12 @@ ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism ) .removeClass( 've-init-mw-desktopArticleTarget-uneditableContent' ); mw.hook( 've.deactivationComplete' ).fire( target.edited ); + + if ( !target.isViewPage ) { + location.href = target.viewUri.clone().extend( { + redirect: mw.config.get( 'wgIsRedirect' ) ? 'no' : undefined + } ); + } } ); } ); };