MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/72639
Change subject: Output unchanged main page instead of nothing if no special
cased ids
......................................................................
Output unchanged main page instead of nothing if no special cased ids
Change-Id: I6afebbafac7b0a05a2c6ecfd883cc90be7d57bde
---
M includes/formatters/MobileFormatter.php
1 file changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/39/72639/1
diff --git a/includes/formatters/MobileFormatter.php
b/includes/formatters/MobileFormatter.php
index 414f253..bd65783 100644
--- a/includes/formatters/MobileFormatter.php
+++ b/includes/formatters/MobileFormatter.php
@@ -225,7 +225,7 @@
/**
* Performs transformations specific to main page
* @param DOMDocument $mainPage: Tree to process
- * @return DOMElement
+ * @return DOMElement|null
*/
protected function parseMainPage( DOMDocument $mainPage ) {
wfProfileIn( __METHOD__ );
@@ -242,11 +242,6 @@
$content = $mainPage->createElement( 'div' );
$content->setAttribute( 'id', 'mainpage' );
-
- // FIXME: Move to ZeroRatedMobileAccess extension
- if ( $zeroLandingPage ) {
- $content->appendChild( $zeroLandingPage );
- }
if ( $featuredArticle ) {
$h2FeaturedArticle = $mainPage->createElement( 'h2',
$this->msg( 'mobile-frontend-featured-article' ) );
@@ -278,6 +273,14 @@
}
}
}
+ if ( $content->childNodes->length == 0 ) {
+ $content = null;
+ } else {
+ // FIXME: Move to ZeroRatedMobileAccess extension
+ if ( $zeroLandingPage ) {
+ $content->appendChild( $zeroLandingPage );
+ }
+ }
wfProfileOut( __METHOD__ );
return $content;
--
To view, visit https://gerrit.wikimedia.org/r/72639
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6afebbafac7b0a05a2c6ecfd883cc90be7d57bde
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits