Merge "Fix history link"

This commit is contained in:
jenkins-bot 2021-11-29 23:36:42 +00:00 committed by Gerrit Code Review
commit f4b3b11053

View file

@ -439,29 +439,36 @@ class SkinMinerva extends SkinMustache {
->getRevisionLookup()
->getTimestampFromId( $out->getRevisionId() );
}
$historyIconClasses = [
'historyIconClass' => MinervaUI::iconClass(
'history-base20', 'mw-ui-icon-small', '', 'wikimedia'
),
'arrowIconClass' => MinervaUI::iconClass(
'expand-gray', 'small',
'mf-mw-ui-icon-rotate-anti-clockwise indicator',
// Uses icon in MobileFrontend so must be prefixed mf.
// Without MobileFrontend it will not render.
// Rather than maintain 2 versions (and variants) of the arrow icon which can conflict
// with each othe and bloat CSS, we'll
// use the MobileFrontend one. Long term when T177432 and T160690 are resolved
// we should be able to use one icon definition and break this dependency.
'mf'
),
];
$historyLink = !$isLatestRevision || $title->isMainPage() ?
$this->getGenericHistoryLink( $title ) :
$this->getRelativeHistoryLink( $title, $timestamp );
// Create history link and corresponding icons.
$historyLinkAndIcons = [];
if ( Action::getActionName( RequestContext::getMain() ) === 'view' ) {
$historyIconClasses = [
'historyIconClass' => MinervaUI::iconClass(
'history-base20', 'mw-ui-icon-small', '', 'wikimedia'
),
'arrowIconClass' => MinervaUI::iconClass(
'expand-gray', 'small',
'mf-mw-ui-icon-rotate-anti-clockwise indicator',
// Uses icon in MobileFrontend so must be prefixed mf.
// Without MobileFrontend it will not render.
// Rather than maintain 2 versions (and variants) of the arrow icon which can conflict
// with each othe and bloat CSS, we'll
// use the MobileFrontend one. Long term when T177432 and T160690 are resolved
// we should be able to use one icon definition and break this dependency.
'mf'
),
];
$historyLink = !$isLatestRevision || $title->isMainPage() ?
$this->getGenericHistoryLink( $title ) :
$this->getRelativeHistoryLink( $title, $timestamp );
$historyLinkAndIcons = $historyLink + $historyIconClasses;
}
$title = $this->getTitle();
return $title->canExist() && $title->exists()
? $historyLink + $historyIconClasses
return $title->canExist() && $title->exists() && !empty( $historyLinkAndIcons )
? $historyLinkAndIcons
: null;
}