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

Change subject: Fix maplink and mapframe when lat/lon/zoom are undefined
......................................................................


Fix maplink and mapframe when lat/lon/zoom are undefined

Bug: T144441
Change-Id: I4f756480f55f93b49fba81298cdc3c0f977dbc8a
(cherry picked from commit 17f23ce0da7f395bcb765cb2a5747775d0da4147)
---
M modules/mapframe/mapframe.js
M modules/maplink/maplink.js
2 files changed, 21 insertions(+), 11 deletions(-)

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



diff --git a/modules/mapframe/mapframe.js b/modules/mapframe/mapframe.js
index df683c8..37e502e 100644
--- a/modules/mapframe/mapframe.js
+++ b/modules/mapframe/mapframe.js
@@ -120,17 +120,22 @@
                        //     #/map/0/5
                        //     #/map/0/16/-122.4006/37.7873
                        router.route( 
/map\/([0-9]+)(?:\/([0-9]+))?(?:\/([\-\+]?\d+\.?\d{0,5})?\/([\-\+]?\d+\.?\d{0,5})?)?/,
 function ( maptagId, zoom, latitude, longitude ) {
-                               var map = maps[ maptagId ];
+                               var map = maps[ maptagId ],
+                                       position;
 
                                if ( !map ) {
                                        router.navigate( '' );
                                        return;
                                }
 
-                               map.openFullScreen( {
-                                       center: [ +latitude, +longitude ],
-                                       zoom: +zoom
-                               } );
+                               if ( zoom !== undefined && latitude !== 
undefined && longitude !== undefined ) {
+                                       position = {
+                                               center: [ +latitude, +longitude 
],
+                                               zoom: +zoom
+                                       };
+                               }
+
+                               map.openFullScreen( position );
                        } );
 
                        // Check if we need to open a map in full screen.
diff --git a/modules/maplink/maplink.js b/modules/maplink/maplink.js
index 8f1361d..ed45dea 100644
--- a/modules/maplink/maplink.js
+++ b/modules/maplink/maplink.js
@@ -10,7 +10,7 @@
  * @class Kartographer.Link
  * @singleton
  */
-module.exports = ( function ( $, mw, router, kartobox ) {
+module.exports = ( function ( $, mw, router, kartobox, undefined ) {
 
        /**
         * References the maplinks of the page.
@@ -90,17 +90,22 @@
                //     #/maplink/0/5
                //     #/maplink/0/16/-122.4006/37.7873
                router.route( 
/maplink\/([0-9]+)(?:\/([0-9]+))?(?:\/([\-\+]?\d+\.?\d{0,5})?\/([\-\+]?\d+\.?\d{0,5})?)?/,
 function ( maptagId, zoom, latitude, longitude ) {
-                       var link = maplinks[ maptagId ];
+                       var link = maplinks[ maptagId ],
+                               position;
 
                        if ( !link ) {
                                router.navigate( '' );
                                return;
                        }
 
-                       link.openFullScreen( {
-                               center: [ +latitude, +longitude ],
-                               zoom: +zoom
-                       } );
+                       if ( zoom !== undefined && latitude !== undefined && 
longitude !== undefined ) {
+                               position = {
+                                       center: [ +latitude, +longitude ],
+                                       zoom: +zoom
+                               };
+                       }
+
+                       link.openFullScreen( position );
                } );
 
                // Check if we need to open a map in full screen.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4f756480f55f93b49fba81298cdc3c0f977dbc8a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: wmf/1.28.0-wmf.17
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: MaxSem <maxsem.w...@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