X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fhistory%2Fjs%2Fhistory.js;h=b9cb9fc5fb00e0e38e748226fd6b838257aab8eb;hb=9424afc6c1f518c301bf87a23c047d1873435d05;hp=aa5ca78a8b15af4e92be6a65bbe14989def8503f;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/modules/history/js/history.js b/web/core/modules/history/js/history.js index aa5ca78a8..b9cb9fc5f 100644 --- a/web/core/modules/history/js/history.js +++ b/web/core/modules/history/js/history.js @@ -8,7 +8,8 @@ (function ($, Drupal, drupalSettings, storage) { var currentUserID = parseInt(drupalSettings.user.uid, 10); - var thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - 30 * 24 * 60 * 60; + var secondsIn30Days = 2592000; + var thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - secondsIn30Days; var embeddedLastReadTimestamps = false; if (drupalSettings.history && drupalSettings.history.lastReadTimestamps) { @@ -28,11 +29,9 @@ data: { 'node_ids[]': nodeIDs }, dataType: 'json', success: function success(results) { - for (var nodeID in results) { - if (results.hasOwnProperty(nodeID)) { - storage.setItem('Drupal.history.' + currentUserID + '.' + nodeID, results[nodeID]); - } - } + Object.keys(results || {}).forEach(function (nodeID) { + storage.setItem('Drupal.history.' + currentUserID + '.' + nodeID, results[nodeID]); + }); callback(); } });