diff --git a/includes/Skins/SkinMinerva.php b/includes/Skins/SkinMinerva.php index bc01c4d9a..e339e8f3e 100644 --- a/includes/Skins/SkinMinerva.php +++ b/includes/Skins/SkinMinerva.php @@ -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; }