// 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;
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();
},
});