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
This commit is contained in:
Bartosz Dziewoński 2018-06-22 01:06:01 +02:00
parent e9f4ebde0f
commit 37e349913e

View file

@ -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
} );
}
} );
} );
};