Jeroen De Dauw has submitted this change and it was merged.

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, 12 insertions(+), 12 deletions(-)

Approvals:
  Jeroen De Dauw: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index fde90cf..aa673df 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,10 +754,17 @@
                $multilangViolationDetector->addConstraintChecks(
                        $entity,
                        $this->status,
-                       $itemDiff
+                       $entityDiff
                );
 
                if ( !$this->status->isOk() ) {
+                       return $this->status;
+               }
+
+               // 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;
                }
 
@@ -785,8 +785,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: merged
Gerrit-Change-Id: If6a05e69e99aa4df5bd625d9534514eea662aec4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to