Fix styling of tabs on history and diff pages

On English Wikipedia, talk tabs are enabled so this went undetected.
The history and diff pages should be loading these styles since they
both have tabs.

Bug: T356117
Change-Id: I380cc4ba9a4f809e4400873241d97de5a5fe6c1f
This commit is contained in:
Jon Robson 2024-01-29 14:17:17 -08:00 committed by Jdlrobson
parent 7a25179c59
commit 568ab16285

View file

@ -423,6 +423,10 @@ class SkinMinerva extends SkinMustache {
return $btns;
}
private function isHistoryPage() {
return $this->getRequest()->getText( 'action' ) === 'history';
}
/**
* Tabs are available if a page has page actions but is not the talk page of
* the main page.
@ -436,7 +440,7 @@ class SkinMinerva extends SkinMustache {
$title = $this->getTitle();
$skinOptions = $this->getSkinOptions();
$isSpecialPageOrHistory = $title->isSpecialPage() ||
$this->getRequest()->getText( 'action' ) === 'history';
$this->isHistoryPage();
$subjectPage = MediaWikiServices::getInstance()->getNamespaceInfo()
->getSubjectPage( $title );
$isMainPageTalk = Title::newFromLinkTarget( $subjectPage )->isMainPage();
@ -655,6 +659,16 @@ class SkinMinerva extends SkinMustache {
];
}
/**
* Checks if the Special:History page is being used.
* @param Title $title The Title object of the page being viewed
* @return bool
*/
private function shouldUseSpecialHistory( Title $title ) {
return ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) &&
SpecialMobileHistory::shouldUseSpecialHistory( $title, $this->getUser() );
}
/**
* Get the URL for the history page for the given title using Special:History
* when available.
@ -662,8 +676,7 @@ class SkinMinerva extends SkinMustache {
* @return string
*/
protected function getHistoryUrl( Title $title ) {
return ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) &&
SpecialMobileHistory::shouldUseSpecialHistory( $title, $this->getUser() ) ?
return $this->shouldUseSpecialHistory( $title ) ?
SpecialPage::getTitleFor( 'History', $title )->getLocalURL() :
$title->getLocalURL( [ 'action' => 'history' ] );
}
@ -1019,6 +1032,9 @@ class SkinMinerva extends SkinMustache {
// and move the associated LESS file inside `skins.minerva.amc.styles`
// into a more appropriate module.
if (
// T356117 - enable on all special pages - some special pages e.g. Special:Contribute have tabs.
$title->isSpecialPage() ||
( $this->isHistoryPage() && !$this->shouldUseSpecialHistory( $title ) ) ||
$skinOptions->get( SkinOptions::PERSONAL_MENU ) ||
$skinOptions->get( SkinOptions::TALK_AT_TOP ) ||
$skinOptions->get( SkinOptions::HISTORY_IN_PAGE_ACTIONS ) ||