Talk overlays for creating new topics now use callback
This copies across code from MobileFrontend and gives Minerva full control of the lifecycle of this talk overlay. Depends-On: Ie2d54659ae746acc3d18368b19918aaafb236202 Bug: T228418 Change-Id: Ice1a56fbb24d9b314dfa7b2d73a4642ad1bc0593
This commit is contained in:
parent
28c84d7d0d
commit
0320d1a9af
@ -50,6 +50,18 @@
|
||||
talkOptions = {
|
||||
api: api,
|
||||
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
|
||||
} );
|
||||
mw.notify( mw.msg( 'mobile-frontend-talk-topic-feedback' ) );
|
||||
},
|
||||
// T184273 using `currentPage` because 'wgPageName'
|
||||
// contains underscores instead of spaces.
|
||||
currentPageTitle: mobile.currentPage().title,
|
||||
@ -84,21 +96,6 @@
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
// After adding a new topic, we need to force a refresh of the talk topics
|
||||
eventBus.on( 'talk-discussion-added', function () {
|
||||
gateway.invalidatePage( talkTitle );
|
||||
// a setTimeout is necessary since talk-discussion-added is fired
|
||||
// BEFORE the overlay is closed. (FIXME)
|
||||
window.setTimeout( function () {
|
||||
// Force a change in the address bar
|
||||
// This is important is #/talk is the current route
|
||||
// (e.g. as is the case after the add discussion overlay has closed)
|
||||
overlayManager.router.navigateTo( '#/talk/', { useReplaceState: true } );
|
||||
// We use second parameter to turn on replaceState
|
||||
// this ensure nobody knows above the route change above!
|
||||
overlayManager.router.navigateTo( '#/talk', { useReplaceState: true } );
|
||||
}, 300 );
|
||||
} );
|
||||
}
|
||||
|
||||
init();
|
||||
|
Loading…
Reference in New Issue
Block a user