Gilles has uploaded a new change for review.

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

Change subject: Parse region in geoip cookie
......................................................................

Parse region in geoip cookie

Depends on I130f406b230dc9c6c7f64c898dce942571f0f5a4

Bug: T101819
Change-Id: I480cbc7adb1a8eed0b5bee71e2b9c6737596f617
---
M modules/ext.centralNotice.bannerController/bannerController.js
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/31/217231/1

diff --git a/modules/ext.centralNotice.bannerController/bannerController.js 
b/modules/ext.centralNotice.bannerController/bannerController.js
index 5533e59..c2b7ee0 100644
--- a/modules/ext.centralNotice.bannerController/bannerController.js
+++ b/modules/ext.centralNotice.bannerController/bannerController.js
@@ -39,12 +39,13 @@
 
        function synthesizeGeoCookie() {
                if ( !window.Geo || !window.Geo.country ) {
-                       $.cookie( 'GeoIP', '::::vx', { path: '/' } );
+                       $.cookie( 'GeoIP', ':::::vx', { path: '/' } );
                        return;
                }
 
                var parts = [
                        window.Geo.country,
+                       window.Geo.region,
                        window.Geo.city.replace( /[^a-z]/i, '_' ),
                        window.Geo.lat,
                        window.Geo.lon,
@@ -54,13 +55,14 @@
                $.cookie( 'GeoIP', parts.join( ':' ), { path: '/' } );
        }
 
-       window.Geo = ( function ( match, country, city, lat, lon, af ) {
+       window.Geo = ( function ( match, country, region, city, lat, lon, af ) {
                if ( typeof country !== 'string' || ( country.length !== 0 && 
country.length !== 2 ) ) {
                    // 'country' is neither empty nor a country code (string of
                    // length 2), so something is wrong with the cookie, and we
                    // cannot rely on its value.
                    $.cookie( 'GeoIP', null, { path: '/' } );
                    country = '';
+                   region = '';
                    city = '';
                    lat = '';
                    lon = '';
@@ -68,12 +70,13 @@
                }
                return {
                        country: country,
+                       region: region,
                        city: city,
                        lat: lat && parseFloat( lat ),
                        lon: lon && parseFloat( lon ),
                        af: af
                };
-       } ).apply( null, ( $.cookie( 'GeoIP' ) || '' ).match( 
/([^:]*):([^:]*):([^:]*):([^:]*):([^;]*)/ ) || [] );
+       } ).apply( null, ( $.cookie( 'GeoIP' ) || '' ).match( 
/([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^;]*)/ ) || [] );
 
        // FIXME Following the switch to client-side banner selection, it would
        // make more sense for this to be defined in bannerController.lib. 
Before

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I480cbc7adb1a8eed0b5bee71e2b9c6737596f617
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Gilles <gdu...@wikimedia.org>

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

Reply via email to