From d3a95084c5219da66d9293bc913c70a6955091c0 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 19 Feb 2019 15:44:53 -0800 Subject: [PATCH] Talk is at bottom of main page In T214724 the talk tabs were removed from the main page in AMC mode, however this also removed the talk button altogether in AMC mode. This updates the logic. Talk tabs are also removed from the talk page for the main page as the tabs come as a pair. Bug: T214724 Bug: T216514 Change-Id: Ic7d54e323d9428fa222e27a86ec2f9d61ae1e5f5 --- includes/skins/MinervaTemplate.php | 4 +++- includes/skins/SkinMinerva.php | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/skins/MinervaTemplate.php b/includes/skins/MinervaTemplate.php index 49eccbb..e0dcd92 100644 --- a/includes/skins/MinervaTemplate.php +++ b/includes/skins/MinervaTemplate.php @@ -40,6 +40,7 @@ class MinervaTemplate extends BaseTemplate { $this->isSpecialMobileMenuPage = $this->isSpecialPage && $title->isSpecial( 'MobileMenu' ); $this->isMainPage = $title->isMainPage(); + $this->isMainPageTalk = $title->getSubjectPage()->isMainPage(); Hooks::run( 'MinervaPreRender', [ $this ] ); $this->render( $this->data ); } @@ -236,6 +237,7 @@ class MinervaTemplate extends BaseTemplate { $preBodyHtml = isset( $data['prebodyhtml'] ) ? $data['prebodyhtml'] : ''; $hasHeadingHolder = $internalBanner || $preBodyHtml || isset( $data['page_actions'] ); $hasPageActions = !$this->isSpecialPage && !$this->isMainPage; + $hasTalkTabs = $hasPageActions && !$this->isMainPageTalk; // prepare template data $templateData = [ @@ -272,7 +274,7 @@ class MinervaTemplate extends BaseTemplate { 'secondaryactionshtml' => $this->getSecondaryActionsHtml(), 'footer' => $this->getFooterTemplateData( $data ), 'isBeta' => $skin->getSkinOption( SkinMinerva::OPTIONS_MOBILE_BETA ), - 'tabs' => $hasPageActions && $skin->getSkinOption( SkinMinerva::OPTIONS_TALK_AT_TOP ) ? [ + 'tabs' => $hasTalkTabs && $skin->getSkinOption( SkinMinerva::OPTIONS_TALK_AT_TOP ) ? [ 'items' => array_values( $data['content_navigation']['namespaces'] ), ] : false, ]; diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index 512700f..9d3c142 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -1098,9 +1098,12 @@ class SkinMinerva extends SkinTemplate { // in beta it will be the entry point for the talk overlay feature, // in stable it will link to the wikitext talk page $title = $this->getTitle(); + $subjectPage = $title->getSubjectPage(); + $talkAtBottom = !$this->getSkinOption( self::OPTIONS_TALK_AT_TOP ) || + $subjectPage->isMainPage(); $namespaces = $tpl->data['content_navigation']['namespaces']; - if ( !$this->getUserPageHelper()->isUserPage() && $this->isTalkAllowed() - && !$this->getSkinOption( self::OPTIONS_TALK_AT_TOP ) + if ( !$this->getUserPageHelper()->isUserPage() + && $this->isTalkAllowed() && $talkAtBottom ) { // FIXME [core]: This seems unnecessary.. $subjectId = $title->getNamespaceKey( '' );