Merge branch 'jquery-cookie-undefined' into 'nightly'

Updates jquery.cookie usage to match changes from v1.4.0

`$.cookie('name')` returns `undefined` instead of `null` when cookie is not present.

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.

Deleting a cookie should use `$.removeCookie('name')` instead of `$.cookie('name', null)`.

[Reference](7f88a4e631/CHANGELOG.md (140)).

See merge request !20
This commit is contained in:
mmn 2015-07-10 14:03:30 +00:00
commit c037f04d17

View File

@ -1081,12 +1081,12 @@ var SN = { // StatusNet
label.attr('title', label.text()); label.attr('title', label.text());
check.change(function () { 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 label
.attr('title', NoticeDataGeo_text.ShareDisable) .attr('title', NoticeDataGeo_text.ShareDisable)
.addClass('checked'); .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) { if (navigator.geolocation) {
SN.U.NoticeGeoStatus(form, 'Requesting location from browser...'); SN.U.NoticeGeoStatus(form, 'Requesting location from browser...');
navigator.geolocation.getCurrentPosition( navigator.geolocation.getCurrentPosition(
@ -1297,7 +1297,7 @@ var SN = { // StatusNet
* @fixme what is this? * @fixme what is this?
*/ */
Delete: function () { Delete: function () {
$.cookie(SN.C.S.StatusNetInstance, null); $.removeCookie(SN.C.S.StatusNetInstance);
} }
}, },