Mercurial > hg > isophonics-drupal-site
diff core/modules/history/js/history.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 |
line wrap: on
line diff
--- a/core/modules/history/js/history.js Mon Apr 23 09:33:26 2018 +0100 +++ b/core/modules/history/js/history.js Mon Apr 23 09:46:53 2018 +0100 @@ -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(); } });