Tobias Gritschacher has uploaded a new change for review.

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


Change subject: (hotfix) Fixed diff of claims with a time property
......................................................................

(hotfix) Fixed diff of claims with a time property

Bug: 48709

Change-Id: Icd7612f60b6595aa567fa634fa981d0be014f968
---
M lib/includes/ClaimDifferenceVisualizer.php
M repo/includes/ClaimSummaryBuilder.php
2 files changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/27/64927/1

diff --git a/lib/includes/ClaimDifferenceVisualizer.php 
b/lib/includes/ClaimDifferenceVisualizer.php
index 226829b..87abdc9 100644
--- a/lib/includes/ClaimDifferenceVisualizer.php
+++ b/lib/includes/ClaimDifferenceVisualizer.php
@@ -1,6 +1,7 @@
 <?php
 namespace Wikibase;
 
+use DataValues\TimeValue;
 use Html;
 use Diff\Diff;
 use Wikibase\Lib\EntityIdFormatter;
@@ -293,6 +294,10 @@
                        // FIXME! should use some value formatter
                        if ( $dataValue instanceof EntityId ) {
                                $diffValueString = $this->getEntityLabel( 
$dataValue );
+                       } else if ( $dataValue instanceof TimeValue ) {
+                               // TODO: this will just display the plain 
ISO8601-string,
+                               // we should instead use a decent formatter
+                               $diffValueString = $dataValue->getTime();
                        } else {
                                $diffValueString = $dataValue->getValue();
                        }
diff --git a/repo/includes/ClaimSummaryBuilder.php 
b/repo/includes/ClaimSummaryBuilder.php
index 50057d7..b1e2675 100644
--- a/repo/includes/ClaimSummaryBuilder.php
+++ b/repo/includes/ClaimSummaryBuilder.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase;
 
+use DataValues\TimeValue;
 use InvalidArgumentException;
 use Wikibase\Lib\EntityIdFormatter;
 
@@ -129,6 +130,10 @@
 
                                if ( $snak instanceof PropertyValueSnak ) {
                                        $value = $snak->getDataValue();
+                                       // TODO: we should use value formatters 
here!
+                                       if ( $value instanceof TimeValue ) {
+                                               $value = $value->getTime();
+                                       }
                                } else {
                                        $value = '-'; // todo handle no values 
in general way (needed elsewhere)
                                }

-- 
To view, visit https://gerrit.wikimedia.org/r/64927
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd7612f60b6595aa567fa634fa981d0be014f968
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to