jenkins-bot has submitted this change and it was merged.
Change subject: Bug 48490: Report correct mode and whether to disable images or
not
......................................................................
Bug 48490: Report correct mode and whether to disable images or not
Move definition of wgMFMode into application.js
Move wgImagesDisabled into makeGlobalVariablesScript so it gets
added to HTML rather than JS which doesn't vary
Change-Id: Ic5f45299e57fa55f1b95ca1753a488b9c4bf7b18
---
M includes/MobileFrontend.hooks.php
M javascripts/common/mf-application.js
2 files changed, 14 insertions(+), 12 deletions(-)
Approvals:
awjrichards: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index f24b475..df7cb9b 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -67,6 +67,7 @@
* @return boolean
*/
public static function onMakeGlobalVariablesScript( &$vars, $out ) {
+ // FIXME: replace instances of [ '' ] with ['']
$skin = $out->getSkin()->getSkinName();
if ( $skin === 'minerva' ) {
$title = $out->getTitle();
@@ -79,6 +80,11 @@
$vars[ 'wgIsPageEditable' ] = $user->isAllowed( 'edit'
) && $title->getNamespace() == NS_MAIN;
$vars[ 'wgPreferredVariant' ] =
$title->getPageLanguage()->getPreferredVariant();
+ $ctx = MobileContext::singleton();
+ // mobile specific config variables
+ if ( $ctx->shouldDisplayMobileView() ) {
+ $vars['wgImagesDisabled'] =
$ctx->imagesDisabled();
+ }
}
return true;
@@ -310,18 +316,6 @@
);
$vars['wgStopMobileRedirectCookie'] =
$wgStopMobileRedirectCookie;
$vars['wgMFNearbyEndpoint'] = $wgMFNearbyEndpoint;
- // mobile specific config variables
- if ( $ctx->shouldDisplayMobileView() ) {
- $vars[ 'wgImagesDisabled' ] = $ctx->imagesDisabled();
- if ( $ctx->isAlphaGroupMember() ) {
- $env = 'alpha';
- } else if ( $ctx->isBetaGroupMember() ) {
- $env = 'beta';
- } else {
- $env = 'stable';
- }
- $vars[ 'wgMFMode' ] = $env;
- }
return true;
}
diff --git a/javascripts/common/mf-application.js
b/javascripts/common/mf-application.js
index 6a2c25e..ee23735 100644
--- a/javascripts/common/mf-application.js
+++ b/javascripts/common/mf-application.js
@@ -100,8 +100,16 @@
function init() {
// FIXME: use wgIsMainPage
var mainPage = document.getElementById( 'mainpage' ),
+ mode, $body = $( 'body' ),
$doc = $( 'html' );
+ if ( $body.hasClass( 'alpha' ) ) {
+ mode = 'alpha';
+ } else {
+ mode = $body.hasClass( 'beta' ) ? 'beta' : 'stable';
+ }
+ mw.config.set( 'wgMFMode', mode );
+
if ( mainPage ) {
emit( 'homepage-loaded' );
}
--
To view, visit https://gerrit.wikimedia.org/r/63822
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5f45299e57fa55f1b95ca1753a488b9c4bf7b18
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits