Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / history / js / history.es6.js
index 53a1d05f25e7e11ecb995a9755c62e46d3d50b7d..dba78b12df3eb081902212ab434fdcac64f78791 100644 (file)
@@ -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;
         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();
         },
       });