Tobias Gritschacher has uploaded a new change for review.

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


Change subject: (bug 51813) apply length constraints to properties too
......................................................................

(bug 51813) apply length constraints to properties too

Change-Id: If6a05e69e99aa4df5bd625d9534514eea662aec4
---
M repo/includes/EditEntity.php
1 file changed, 5 insertions(+), 12 deletions(-)


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

diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index fde90cf..75dbc79 100644
--- a/repo/includes/EditEntity.php
+++ b/repo/includes/EditEntity.php
@@ -742,18 +742,11 @@
                 */
                $entity = $this->newContent->getEntity();
 
-               // TODO: the below logic is Item specific, so would be good if 
this got handled
-               // using composition or polymorphism.
-
-               if ( $entity->getType() !== Item::ENTITY_TYPE ) {
-                       return $this->status;
-               }
-
-               $itemDiff = null;
+               $entityDiff = null;
 
                if ( $this->getBaseContent() instanceof EntityContent ) {
                        //XXX: havn't we calculated this diff already?
-                       $itemDiff = $entity->getDiff( 
$this->getBaseContent()->getEntity() );
+                       $entityDiff = $entity->getDiff( 
$this->getBaseContent()->getEntity() );
                }
                //XXX: ...else diff against an empty item?...
 
@@ -761,7 +754,7 @@
                $multilangViolationDetector->addConstraintChecks(
                        $entity,
                        $this->status,
-                       $itemDiff
+                       $entityDiff
                );
 
                if ( !$this->status->isOk() ) {
@@ -785,8 +778,8 @@
                                $entity,
                                $this->status,
                                StoreFactory::getStore()->getTermIndex(),
-                               $itemDiff === null ? null : 
$itemDiff->getLabelsDiff(),
-                               $itemDiff === null ? null : 
$itemDiff->getDescriptionsDiff()
+                               $entityDiff === null ? null : 
$entityDiff->getLabelsDiff(),
+                               $entityDiff === null ? null : 
$entityDiff->getDescriptionsDiff()
                        );
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6a05e69e99aa4df5bd625d9534514eea662aec4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to