jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/403448 )
Change subject: Move code displaying EntityId on diff pages
......................................................................
Move code displaying EntityId on diff pages
Reasoning:
* The overridePageMetaTags got quite clunky. It was hard to understand
what it does.
* setDiffPageTitle does have access to $outputPage anyway.
* This way I can get rid of one of the if-else structures entirely.
They both really encoded the same knowledge.
Bug: T181077
Change-Id: I29c18c8ad9dbd73cd89cf21d0908e7d042e5244d
---
M repo/includes/Actions/ViewEntityAction.php
1 file changed, 10 insertions(+), 24 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/Actions/ViewEntityAction.php
b/repo/includes/Actions/ViewEntityAction.php
index b13a12c..fd7d62f 100644
--- a/repo/includes/Actions/ViewEntityAction.php
+++ b/repo/includes/Actions/ViewEntityAction.php
@@ -92,19 +92,7 @@
if ( $this->isDiff() ) {
if ( isset( $meta['title'] ) ) {
- $configVars = $outputPage->getJsConfigVars();
- if ( !isset( $configVars['wbEntityId'] ) ) {
- wfLogWarning( "'wbEntityId' has not
been found." );
- $entityId = null;
- } else {
- $entityId = $configVars['wbEntityId'];
- }
-
- $this->setDiffPageTitle(
- $outputPage,
- $meta['title'],
- $entityId
- );
+ $this->setDiffPageTitle( $outputPage,
$meta['title'] );
}
// No description, social media tags, or any search
engine optimization for diffs
@@ -129,21 +117,19 @@
/**
* @param OutputPage $outputPage
* @param string $titleText
- * @param string $entityIdSerialization
*/
- private function setDiffPageTitle(
- OutputPage $outputPage,
- $titleText,
- $entityIdSerialization
- ) {
- if ( $entityIdSerialization !== null ) {
- $id = ' ' . Html::element(
+ private function setDiffPageTitle( OutputPage $outputPage, $titleText )
{
+ $variables = $outputPage->getJsConfigVars();
+
+ if ( !isset( $variables['wbEntityId'] ) ) {
+ wfLogWarning( "'wbEntityId' has not been found." );
+ $id = '';
+ } else {
+ $id = ' ' . Html::element(
'span',
[ 'class' => 'wikibase-title-id' ],
- $this->msg( 'parentheses' )->plaintextParams(
$entityIdSerialization )
+ $this->msg( 'parentheses' )->plaintextParams(
$variables['wbEntityId'] )
);
- } else {
- $id = '';
}
// Escaping HTML characters in order to retain original label
that may contain HTML
--
To view, visit https://gerrit.wikimedia.org/r/403448
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I29c18c8ad9dbd73cd89cf21d0908e7d042e5244d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits