X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fcomment%2Fjs%2Fnode-new-comments-link.es6.js;h=a2bdc35b9d7272b4950f55f303a27b73eacf0486;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=9f1588fd99acb36f8c3d48f696d1c6600cec731b;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website
diff --git a/web/core/modules/comment/js/node-new-comments-link.es6.js b/web/core/modules/comment/js/node-new-comments-link.es6.js
index 9f1588fd9..a2bdc35b9 100644
--- a/web/core/modules/comment/js/node-new-comments-link.es6.js
+++ b/web/core/modules/comment/js/node-new-comments-link.es6.js
@@ -66,9 +66,11 @@
// Find the parent
.
.closest('.comment-new-comments')
// Find the preceding , if any, and give it the 'last' class.
- .prev().addClass('last')
+ .prev()
+ .addClass('last')
// Go back to the parent and hide it.
- .end().hide();
+ .end()
+ .hide();
}
/**
@@ -95,9 +97,11 @@
// Find the parent .
.closest('.comment-new-comments')
// Find the preceding , if any, and remove its 'last' class, if any.
- .prev().removeClass('last')
+ .prev()
+ .removeClass('last')
// Go back to the parent and show it.
- .end().show();
+ .end()
+ .show();
}
/**
@@ -145,15 +149,15 @@
* Data about new comment links indexed by nodeID.
*/
function render(results) {
- for (const nodeID in results) {
- if (results.hasOwnProperty(nodeID) && $placeholdersToUpdate.hasOwnProperty(nodeID)) {
+ Object.keys(results || {}).forEach((nodeID) => {
+ if ($placeholdersToUpdate.hasOwnProperty(nodeID)) {
$placeholdersToUpdate[nodeID]
.attr('href', results[nodeID].first_new_comment_link)
.text(Drupal.formatPlural(results[nodeID].new_comment_count, '1 new comment', '@count new comments'))
.removeClass('hidden');
show($placeholdersToUpdate[nodeID]);
}
- }
+ });
}
if (drupalSettings.comment && drupalSettings.comment.newCommentsLinks) {