jenkins-bot has submitted this change and it was merged.
Change subject: Simplify enable sections if statement
......................................................................
Simplify enable sections if statement
if $this->expandableSections is set we should enable sections regardless
only disable in case of main page
otherwise the function is misleading as it doesn't always enable expandable
sections
Alpha sections as a result no longer cleared
Change-Id: Ic4fffd3cf4ddb558dc966865034dd3398e0bf1fc
---
M includes/MobileFormatter.php
M includes/MobileFrontend.body.php
M includes/api/ApiMobileView.php
M includes/api/ApiParseExtender.php
4 files changed, 6 insertions(+), 3 deletions(-)
Approvals:
MaxSem: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php
index 8cf3c57..92e093d 100644
--- a/includes/MobileFormatter.php
+++ b/includes/MobileFormatter.php
@@ -153,7 +153,7 @@
protected function onHtmlReady( $html ) {
switch ( $this->format ) {
case 'HTML':
- if ( $this->expandableSections &&
!$this->mainPage && strlen( $html ) > 4000 ) {
+ if ( $this->expandableSections && strlen( $html
) > 4000 ) {
$html = $this->headingTransform( $html
);
if ( $this->removeSections ) {
$temp = new HtmlFormatter(
$html ); // hack hack hack
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index 78ee268..7eced46 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -168,14 +168,15 @@
}
wfProfileIn( __METHOD__ . '-getText' );
+ $isMainPage = $this->getTitle()->isMainPage();
if ( !$context->isAlphaGroupMember() ) {
- $formatter->setIsMainPage(
$this->getTitle()->isMainPage() );
+ $formatter->setIsMainPage( $isMainPage );
}
if ( $context->getContentFormat() == 'HTML'
&& $this->getRequest()->getText( 'search' ) == '' )
{
- $formatter->enableExpandableSections();
+ $formatter->enableExpandableSections( !$isMainPage );
}
$contentHtml = $formatter->getText();
wfProfileOut( __METHOD__ . '-getText' );
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index 95631c5..7579226 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -173,6 +173,7 @@
$mf->filterContent();
$mf->setIsMainPage( $this->mainPage );
}
+ $mf->enableExpandableSections( !$this->mainPage );
$html = $mf->getText();
wfProfileOut( __METHOD__ . '-MobileFormatter' );
diff --git a/includes/api/ApiParseExtender.php
b/includes/api/ApiParseExtender.php
index 2b95cd7..88df06c 100644
--- a/includes/api/ApiParseExtender.php
+++ b/includes/api/ApiParseExtender.php
@@ -84,6 +84,7 @@
);
$mf->removeImages( $params['noimages'] );
$mf->setIsMainPage( $params['mainpage'] );
+ $mf->enableExpandableSections(
!$params['mainpage'] );
$mf->filterContent();
$data['parse']['text'] = $mf->getText();
--
To view, visit https://gerrit.wikimedia.org/r/60888
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic4fffd3cf4ddb558dc966865034dd3398e0bf1fc
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits