JGirault has uploaded a new change for review.

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

Change subject: Fix closing map by going back sometimes not working
......................................................................

Fix closing map by going back sometimes not working

Bug: T151915
Change-Id: I478719a682f4001dc089f5a7439c728c3cf623cf
---
M modules/dialog/index.js
1 file changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer 
refs/changes/49/324849/1

diff --git a/modules/dialog/index.js b/modules/dialog/index.js
index 5de18ec..34c705e 100644
--- a/modules/dialog/index.js
+++ b/modules/dialog/index.js
@@ -32,6 +32,13 @@
                windowManager = null;
        }
 
+       function closeIfMapRoute( routeEv ) {
+               var isMapRoute = routeEv.path.slice( 0, 5 ) === '/map/' || 
routeEv.path.slice( 0, 9 ) === '/maplink/';
+               if ( !isMapRoute ) {
+                       close();
+               }
+       }
+
        return {
                /**
                 * Opens the map dialog and renders the map.
@@ -44,9 +51,7 @@
                                dialog = getMapDialog();
 
                        if ( map.useRouter && !routerEnabled ) {
-                               router.route( '', function () {
-                                       close();
-                               } );
+                               router.on( 'route', closeIfMapRoute );
                        }
 
                        if ( !window.opened ) {
@@ -90,9 +95,7 @@
                                        map = mw.loader.require( 
'ext.kartographer.box' ).map( mapObject );
 
                                        if ( map.useRouter && !routerEnabled ) {
-                                               router.route( '', function () {
-                                                       close();
-                                               } );
+                                               router.on( 'route', 
closeIfMapRoute );
                                        }
 
                                        dialog.setup.call( dialog, { map: map } 
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I478719a682f4001dc089f5a7439c728c3cf623cf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: JGirault <julien.inbox.w...@gmail.com>

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

Reply via email to