Go back before replacing current overlay

There are 2 ways to reach the talk topic create overlay
1) Navigating via link in page directly (currently only possible
on talk pages via new topic button)
2) From the list of talk topics

After saving in both cases you want to "GO BACK" and exit the overlay
before replacing it - otherwise what happens is you end up
replacing the create talk topic overlay with a list of talk topics
with the old instance of the talk overlay underneath (which causes
the OverlayManager a lot of confusion)

You need to go back before replacing stuff.

Bug: T229972
Change-Id: I7cc65dab8883744496380f4e1119cdc31f18f791
This commit is contained in:
jdlrobson 2019-08-07 13:17:39 -07:00 committed by Jdlrobson
parent ebfd2760f9
commit e09a6930b8
1 changed files with 15 additions and 8 deletions

View File

@ -65,14 +65,21 @@
title: title,
onSaveComplete: function () {
gateway.invalidatePage( title );
overlayManager.replaceCurrent(
mobile.talk.overlay( title, gateway )
);
overlayManager.router.navigateTo( null, {
// This should be defined in Minerva.
path: '#/talk',
useReplaceState: true
} );
// navigate back. the overlay is done with so close it
overlayManager.router.back();
try {
overlayManager.replaceCurrent(
mobile.talk.overlay( title, gateway )
);
overlayManager.router.navigateTo( null, {
// This should be defined in Minerva.
path: '#/talk',
useReplaceState: true
} );
} catch ( e ) {
// the user came directly - there is no overlay to replace
// so no overlay to refresh
}
mw.notify( mw.msg( 'mobile-frontend-talk-topic-feedback' ) );
},
// T184273 using `currentPage` because 'wgPageName'