Minerva should use the MobileFrontend eventBusSingleton

The talk overlay is created inside MobileFrontend, but the
overlay for creating a new talk overlay is here.

The two need to speak to either other - in particularly, the create
talk overlay must invalidate the current talk page before returning
the user to the former.

In preparation for the refactoring changes in MobileFrontend, the
same object is shared and the cache invalidation is moved here since
Minerva creates and manages the PageGateway instance that is given
to the talk overlay.

Additional change:
* Update a selector broken by changes in
I8c34646b7ba13a26facbb69684e65109870d27a1

Bug: T217102
Change-Id: I212ff044c4c608c6ea60a5fda043166cd434ec1f
This commit is contained in:
jdlrobson 2019-03-01 09:37:53 -08:00
parent 454eb6dcf4
commit 4b4e9d6399
2 changed files with 5 additions and 4 deletions

View File

@ -1,9 +1,9 @@
( function ( M, EventEmitter ) {
( function ( M ) {
var
mobile = M.require( 'mobile.startup' ),
loader = mobile.rlModuleLoader,
loadingOverlay = mobile.loadingOverlay,
eventBus = new EventEmitter(),
eventBus = mobile.eventBusSingleton,
PageGateway = mobile.PageGateway,
api = new mw.Api(),
gateway = new PageGateway( api ),
@ -85,6 +85,7 @@
} );
// 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 () {
@ -114,4 +115,4 @@
}, 10 );
} );
}
}( mw.mobileFrontend, OO.EventEmitter ) );
}( mw.mobileFrontend ) );

View File

@ -195,7 +195,7 @@ class ArticlePage
a(:talktopic_save, css: '.overlay .confirm-save')
p(:talk_overlay_content_header, css: '.talk-overlay .content-header')
li(:talk_overlay_first_topic_title, css: '.talk-overlay .topic-title-list li:first-child')
text_field(:talk_overlay_summary, css: '.talk-overlay .summary')
text_field(:talk_overlay_summary, css: '.talk-overlay input')
text_area(:talk_overlay_wikitext_editor, css: '.talk-overlay .wikitext-editor')
button(:talk_overlay_save_button, css: '.talk-overlay .confirm-save')
end