Page MenuHomePhabricator

Remove MinervaTemplate::getHistoryLinkHtml, fold functionality into SkinMinerva
Closed, ResolvedPublic3 Estimated Story Points

Description

The MinervaTemplate getHistoryLink method generates data and creates a new instance of TemplateParser to render a Mustache template called history. The data generation should be moved to SkinMinerva::getTemplateData

  • MinervaTemplate::getHistoryLinkHtml should not exist
  • SkinMinerva::getTemplateData should set a field data-history-link that can be used inside minerva.mustache to be passed into history.mustache
  • The new method should be consolidated with this code in SkinMinerva::prepareHeaderAndFooter
		if ( $this->canUseWikiPage() && $this->getWikiPage()->exists() ) {
			$tpl->set( 'historyLink', $this->getHistoryLink( $title ) );
		}
  • SkinMinerva should not create another instance of TemplateParser <<< this should be completely removed in T293815

Developer notes

The history link function:

protected function getHistoryLinkHtml( $data ) {
		$action = Action::getActionName( RequestContext::getMain() );
		if ( isset( $data['historyLink'] ) && $action === 'view' ) {
			$args = [
				'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'
				 ),
			]   $data['historyLink'];
			$templateParser = new TemplateParser( __DIR__ );
			return $templateParser->processTemplate( 'history', $args );
		}

		return '';

QA steps

Screen Shot 2021-11-01 at 4.42.02 PM.png (1×2 px, 442 KB)

QA Results - Beta & Prod

ACStatusDetails
1T292554#7487905

Event Timeline

Change 735686 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[mediawiki/skins/MinervaNeue@master] Move history link data into SkinMinerva::getTemplateData and relevant template

https://gerrit.wikimedia.org/r/735686

cjming moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.
cjming subscribed.

Change 735686 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Move history link data into SkinMinerva::getTemplateData and relevant template

https://gerrit.wikimedia.org/r/735686

Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: beta/enwiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Screen Shot 2021-11-07 at 6.38.36 AM.png (1×928 px, 255 KB)

Screen Shot 2021-11-07 at 6.38.33 AM.png (1×972 px, 303 KB)

Screen Shot 2021-11-07 at 6.38.03 AM.png (1×972 px, 293 KB)

@This looks like a parity task between prod and beta. No need to retest in Prod.

Jdlrobson updated the task description. (Show Details)