From 9e1d4bfbf038c96e6e9e760ffc46f2f3a1cc6c37 Mon Sep 17 00:00:00 2001 From: Chimo Date: Sat, 20 Jun 2015 19:26:45 -0400 Subject: [PATCH 1/2] jquery-cookie returns `undefined` as of 1.4.0 when a cookie isn't set. This fixes a problem where the browser was never asking for location, and the JSON.parse call was throwing an exception when the geolocation cookie wasn't present. --- js/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/util.js b/js/util.js index b0274a91ba..9cde30ebf4 100644 --- a/js/util.js +++ b/js/util.js @@ -1081,12 +1081,12 @@ var SN = { // StatusNet label.attr('title', label.text()); check.change(function () { - if (check.prop('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) { + if (check.prop('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === undefined) { label .attr('title', NoticeDataGeo_text.ShareDisable) .addClass('checked'); - if ($.cookie(SN.C.S.NoticeDataGeoCookie) === null || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') { + if ($.cookie(SN.C.S.NoticeDataGeoCookie) === undefined || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') { if (navigator.geolocation) { SN.U.NoticeGeoStatus(form, 'Requesting location from browser...'); navigator.geolocation.getCurrentPosition( From a25d952ef9ab458b875e6a250d101178b8a582bb Mon Sep 17 00:00:00 2001 From: Chimo Date: Sat, 20 Jun 2015 19:35:43 -0400 Subject: [PATCH 2/2] $.cookie('n', null) -> $.removeCookie as of 1.4.0 --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 9cde30ebf4..cd982bbb17 100644 --- a/js/util.js +++ b/js/util.js @@ -1297,7 +1297,7 @@ var SN = { // StatusNet * @fixme what is this? */ Delete: function () { - $.cookie(SN.C.S.StatusNetInstance, null); + $.removeCookie(SN.C.S.StatusNetInstance); } },