Jdlrobson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/379783 )
Change subject: Third party main page logic is incorrect ...................................................................... Third party main page logic is incorrect On a wiki where special casing of main page is not enabled we should not add the toggling indicator and JS as we do not run toggling code on the main page. It is expected that main pages will be minimal content that help users find their way around the site - they are not meant for long form reading so section collapsing is not useful here. When special casing is enabled we also do not run this code. Changes: * Call enableExpandableSections once and set it regardless of whether main page special casing is enabled * Mark setMainPage as deprecated - it is confusing and long term it will be removed - it actually means "special case main page" - update documentation to explain this. Bug: T176414 Change-Id: I20acfddede6ae013e3216e19eca280dd0a094691 --- M includes/MobileFormatter.php 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/83/379783/1 diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php index 0041bcf..3101a0e 100644 --- a/includes/MobileFormatter.php +++ b/includes/MobileFormatter.php @@ -59,7 +59,7 @@ */ protected $expandableSections = false; /** - * Whether actual page is the main page + * Whether actual page is the main page and should be special cased * @var boolean $mainPage */ protected $mainPage = false; @@ -110,17 +110,15 @@ $mfSpecialCaseMainPage = $context->getMFConfig()->get( 'MFSpecialCaseMainPage' ); $title = $context->getTitle(); - $isMainPage = $title->isMainPage() && $mfSpecialCaseMainPage; + $isMainPage = $title->isMainPage(); $isFilePage = $title->inNamespace( NS_FILE ); $isSpecialPage = $title->isSpecialPage(); $html = self::wrapHTML( $provider->getHTML() ); $formatter = new MobileFormatter( $html, $title ); - $formatter->enableExpandableSections( !$isMainPage && !$isSpecialPage ); + $formatter->enableExpandableSections( !$isMainPage && !$isSpecialPage && $enableSections ); - $formatter->setIsMainPage( $isMainPage ); - - $formatter->enableExpandableSections( $enableSections ); + $formatter->setIsMainPage( $isMainPage && $mfSpecialCaseMainPage ); $formatter->enableTOCPlaceholder( $includeTOC ); return $formatter; @@ -146,6 +144,8 @@ /** * Change mainPage (is this the main page) to $value (standard: true) + * This enables special casing for the main page. + * @deprecated * @param bool $value */ public function setIsMainPage( $value = true ) { -- To view, visit https://gerrit.wikimedia.org/r/379783 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I20acfddede6ae013e3216e19eca280dd0a094691 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits