Minerva is responsible for turning on WikimediaEvents itself

Unlike other skins, Minerva wants to be in charge of when WikimediaEvents
is loaded, so that it can guarantee load order happens at a time that
suits it.

WikimediaEvents will be loaded after initialisation of the interface.
This allows Minerva to enable schemas such as ReadingDepth conditionally.

Upon merging this patch, Ibb45f40ea301727c0c6480043760bd9426106845 can
be merged which will revoke WikimediaEvent's ownership.
Merging in this order will ensure that ReadingDepth  is never
removed from production.

Bug: T204144
Change-Id: If8395033f31485aca0ca3b38fda1be985369b481
This commit is contained in:
jdlrobson 2018-09-18 15:50:35 -07:00 committed by Jdlrobson
parent 2163d5f965
commit 01dc9de92e
3 changed files with 14 additions and 1 deletions

View File

@ -3,6 +3,7 @@
toast = M.require( 'mobile.startup/toast' ),
time = M.require( 'mobile.startup/time' ),
skin = M.require( 'mobile.init/skin' ),
subscribeToWikimediaEvents = M.require( 'skins.minerva.scripts/subscribeToWikimediaEvents' ),
issues = M.require( 'skins.minerva.scripts/pageIssues' ),
DownloadIcon = M.require( 'skins.minerva.scripts/DownloadIcon' ),
browser = M.require( 'mobile.startup/Browser' ).getSingleton(),
@ -289,6 +290,9 @@
if ( !page.isMissing ) {
issues.init( overlayManager, page );
}
// it's important this runs after issues.init - at which point the A/B test
// has been initialised, and we can turn on ReadingDepth safely.
subscribeToWikimediaEvents();
} );
M.define( 'skins.minerva.scripts/overlayManager', overlayManager );

View File

@ -3,7 +3,16 @@
( function ( M, $ ) {
var mainMenu = M.require( 'skins.minerva.scripts.top/mainMenu' );
/**
* Enable WikimediaEvents including ReadingDepth schema
*/
function subscribeToWikimediaEvents() {
mw.loader.using( 'ext.wikimediaEvents' );
}
$( function () {
mainMenu.enableLogging();
} );
M.define( 'skins.minerva.scripts/subscribeToWikimediaEvents', subscribeToWikimediaEvents );
}( mw.mobileFrontend, jQuery ) );

View File

@ -424,6 +424,7 @@
},
"scripts": [
"resources/skins.minerva.scripts/errorLogging.js",
"resources/skins.minerva.scripts/initLogging.js",
"resources/skins.minerva.scripts/preInit.js",
"resources/skins.minerva.scripts/DownloadIcon.js",
"resources/skins.minerva.scripts/pageIssuesLogger.js",
@ -432,7 +433,6 @@
"resources/skins.minerva.scripts/PageIssuesOverlay.js",
"resources/skins.minerva.scripts/pageIssues.js",
"resources/skins.minerva.scripts/init.js",
"resources/skins.minerva.scripts/initLogging.js",
"resources/skins.minerva.scripts/mobileRedirect.js",
"resources/skins.minerva.scripts/search.js",
"resources/skins.minerva.scripts/references.js"