X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fhistory%2Fjs%2Fhistory.es6.js;fp=web%2Fcore%2Fmodules%2Fhistory%2Fjs%2Fhistory.es6.js;h=dba78b12df3eb081902212ab434fdcac64f78791;hp=53a1d05f25e7e11ecb995a9755c62e46d3d50b7d;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/history/js/history.es6.js b/web/core/modules/history/js/history.es6.js index 53a1d05f2..dba78b12d 100644 --- a/web/core/modules/history/js/history.es6.js +++ b/web/core/modules/history/js/history.es6.js @@ -10,7 +10,8 @@ // Any comment that is older than 30 days is automatically considered read, // so for these we don't need to perform a request at all! - const thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - 30 * 24 * 60 * 60; + const secondsIn30Days = 2592000; + const thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - secondsIn30Days; // Use the data embedded in the page, if available. let embeddedLastReadTimestamps = false; @@ -44,11 +45,9 @@ data: { 'node_ids[]': nodeIDs }, dataType: 'json', success(results) { - for (const nodeID in results) { - if (results.hasOwnProperty(nodeID)) { - storage.setItem(`Drupal.history.${currentUserID}.${nodeID}`, results[nodeID]); - } - } + Object.keys(results || {}).forEach((nodeID) => { + storage.setItem(`Drupal.history.${currentUserID}.${nodeID}`, results[nodeID]); + }); callback(); }, });