jenkins-bot has submitted this change and it was merged.

Change subject: Use externalData properties for geoshape service
......................................................................


Use externalData properties for geoshape service

Bug: T145151
Change-Id: I1adfea768e778b83eb1fa530887ea6d54ba41259
---
M modules/box/Map.js
1 file changed, 13 insertions(+), 0 deletions(-)

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



diff --git a/modules/box/Map.js b/modules/box/Map.js
index 45640f4..50ec8a8 100644
--- a/modules/box/Map.js
+++ b/modules/box/Map.js
@@ -246,6 +246,7 @@
                                uri.query.getgeojson = 1;
 
                                return $.getJSON( uri.toString() ).then( 
function ( geoshape ) {
+                                       var baseProps = data.properties;
                                        delete data.href;
 
                                        // HACK: workaround for T144777 - we 
should be using topojson instead
@@ -256,6 +257,18 @@
                                        // $.each( geoshape.objects, function ( 
key ) {
                                        //      data.features.push( 
topojson.feature( geoshape, geoshape.objects[ key ] ) );
                                        // } );
+
+                                       // Each feature returned from geoshape 
service may contain "properties"
+                                       // If externalData element has 
properties, merge it with properties in the feature
+                                       if ( baseProps ) {
+                                               $.each( data.features, function 
( index, feature ) {
+                                                       if ( $.isEmptyObject( 
feature.properties ) ) {
+                                                               
feature.properties = baseProps;
+                                                       } else {
+                                                               
feature.properties = $.extend( {}, baseProps, feature.properties );
+                                                       }
+                                               } );
+                                       }
                                } );
 
                        default:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1adfea768e778b83eb1fa530887ea6d54ba41259
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: JGirault <julien.inbox.w...@gmail.com>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Yurik <yu...@wikimedia.org>
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