mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
ArticleTarget: Always reload the page after save on non-view page
This is currently only handled in DesktopArticleTarget in teardown, which happens after we've wasted time trying to update the page. Also ensure we always reload on non-view pages on MobileArticleTarget for other types of teardown (e.g. quitting the editor). Change-Id: I7fb352fcacc8727bb113115e98af38a3940a8f9c
This commit is contained in:
parent
ae58439c41
commit
37b81b5ba4
|
@ -628,12 +628,14 @@ ve.init.mw.ArticleTarget.prototype.saveComplete = function ( data ) {
|
|||
|
||||
var target = this;
|
||||
|
||||
if ( !this.pageExists || this.restoring ) {
|
||||
// This is a page creation, a restoration, or we loaded the editor from a non-view page: refresh the page.
|
||||
if ( !this.pageExists || this.restoring || !this.isViewPage ) {
|
||||
// Teardown the target, ensuring auto-save data is cleared
|
||||
this.teardown().then( function () {
|
||||
|
||||
// This is a page creation or restoration, refresh the page
|
||||
var newUrlParams = data.newrevid === undefined ? {} : { venotify: target.restoring ? 'restored' : 'created' };
|
||||
var newUrlParams = !this.pageExists || this.restoring ?
|
||||
( data.newrevid === undefined ? {} : { venotify: target.restoring ? 'restored' : 'created' } ) :
|
||||
{};
|
||||
|
||||
if ( data.isRedirect ) {
|
||||
newUrlParams.redirect = 'no';
|
||||
|
|
|
@ -438,6 +438,21 @@ ve.init.mw.MobileArticleTarget.prototype.tryTeardown = function () {
|
|||
this.overlay.onExitClick( $.Event() );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.MobileArticleTarget.prototype.teardown = function () {
|
||||
var target = this;
|
||||
// Parent method
|
||||
return ve.init.mw.MobileArticleTarget.super.prototype.teardown.call( this ).then( function () {
|
||||
if ( !target.isViewPage ) {
|
||||
location.href = target.viewUri.clone().extend( {
|
||||
redirect: mw.config.get( 'wgIsRedirect' ) ? 'no' : undefined
|
||||
} );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue