[MediaWiki-commits] [Gerrit] Parse region in geoip cookie - change (mediawiki...CentralNotice)
Ori.livneh has submitted this change and it was merged. Change subject: Parse region in geoip cookie .. Parse region in geoip cookie Depends on I130f406b230dc9c6c7f64c898dce942571f0f5a4 Bug: T101819 Change-Id: I480cbc7adb1a8eed0b5bee71e2b9c6737596f617 (cherry picked from commit d24bbd0411ecb6675f22bfa04cdb58e1e85c7701) --- M modules/ext.centralNotice.bannerController/bannerController.js 1 file changed, 6 insertions(+), 3 deletions(-) Approvals: Ori.livneh: Verified; Looks good to me, approved 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/218805 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I480cbc7adb1a8eed0b5bee71e2b9c6737596f617 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralNotice Gerrit-Branch: wmf_deploy Gerrit-Owner: Ori.livneh Gerrit-Reviewer: Gilles Gerrit-Reviewer: Ori.livneh Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Parse region in geoip cookie - change (mediawiki...CentralNotice)
Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/218805 Change subject: Parse region in geoip cookie .. Parse region in geoip cookie Depends on I130f406b230dc9c6c7f64c898dce942571f0f5a4 Bug: T101819 Change-Id: I480cbc7adb1a8eed0b5bee71e2b9c6737596f617 (cherry picked from commit d24bbd0411ecb6675f22bfa04cdb58e1e85c7701) --- 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/05/218805/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/218805 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: wmf_deploy Gerrit-Owner: Ori.livneh Gerrit-Reviewer: Gilles ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Parse region in geoip cookie - change (mediawiki...CentralNotice)
jenkins-bot has submitted this change and it was merged. 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(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified 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: merged Gerrit-Change-Id: I480cbc7adb1a8eed0b5bee71e2b9c6737596f617 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CentralNotice Gerrit-Branch: master Gerrit-Owner: Gilles Gerrit-Reviewer: AndyRussG Gerrit-Reviewer: Awight Gerrit-Reviewer: Cdentinger Gerrit-Reviewer: Ejegg Gerrit-Reviewer: Ori.livneh Gerrit-Reviewer: Ssmith Gerrit-Reviewer: XenoRyet Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Parse region in geoip cookie - change (mediawiki...CentralNotice)
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 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits