Mercurial > hg > isophonics-drupal-site
diff core/modules/history/js/history.es6.js @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/core/modules/history/js/history.es6.js Mon Apr 23 09:33:26 2018 +0100 +++ b/core/modules/history/js/history.es6.js Mon Apr 23 09:46:53 2018 +0100 @@ -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(); }, });