Addshore has submitted this change and it was merged.

Change subject: Removed .toJSON() usage in wikibase.SnakList.getPropertyOrder
......................................................................


Removed .toJSON() usage in wikibase.SnakList.getPropertyOrder

(bug 56673)
Not calling .toJSON() prevents serializing each snak which triggers an Error if
the snak features an UnUnserialzableValue.

Change-Id: Ied888ac7e1962332b6915a36238094a6879b71de
---
M lib/resources/wikibase.datamodel/wikibase.SnakList.js
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/resources/wikibase.datamodel/wikibase.SnakList.js 
b/lib/resources/wikibase.datamodel/wikibase.SnakList.js
index 899cdbc..da7f544 100644
--- a/lib/resources/wikibase.datamodel/wikibase.SnakList.js
+++ b/lib/resources/wikibase.datamodel/wikibase.SnakList.js
@@ -221,11 +221,14 @@
         * @return {string[]}
         */
        getPropertyOrder: function() {
-               var json = this.toJSON(),
-                       propertyIds = [];
+               var propertyIds = [];
 
-               $.each( json, function( propertyId, snak ) {
-                       propertyIds.push( propertyId );
+               this.each( function( i, snak ) {
+                       var propertyId = snak.getPropertyId();
+
+                       if( $.inArray( propertyId, propertyIds ) === -1 ) {
+                               propertyIds.push( propertyId );
+                       }
                } );
 
                return propertyIds;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ied888ac7e1962332b6915a36238094a6879b71de
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to