diff options
author | Alex Pott <alex.a.pott@googlemail.com> | 2020-01-28 11:36:14 +0000 |
---|---|---|
committer | Alex Pott <alex.a.pott@googlemail.com> | 2020-01-28 11:36:14 +0000 |
commit | 2dadb738bfd48510db2174323528fe769731c05a (patch) | |
tree | f6319d9bfa9af8b41dc0ca7c187bef1eaf17aee4 /core/modules/comment/js | |
parent | 09b78ffb1bc1bb62d21fb3abb85e1349a674597a (diff) | |
download | drupal-2dadb738bfd48510db2174323528fe769731c05a.tar.gz drupal-2dadb738bfd48510db2174323528fe769731c05a.zip |
Issue #3101543 by lauriii, bnjmnm, ravi.shankar: Update core JavaScript dependencies listed in package.json
Diffstat (limited to 'core/modules/comment/js')
-rw-r--r-- | core/modules/comment/js/comment-new-indicator.js | 4 | ||||
-rw-r--r-- | core/modules/comment/js/node-new-comments-link.js | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/core/modules/comment/js/comment-new-indicator.js b/core/modules/comment/js/comment-new-indicator.js index 88587d5724c3..a59a70803c82 100644 --- a/core/modules/comment/js/comment-new-indicator.js +++ b/core/modules/comment/js/comment-new-indicator.js @@ -9,8 +9,7 @@ function processCommentNewIndicators($placeholders) { var isFirstNewComment = true; var newCommentString = Drupal.t('new'); - var $placeholder = void 0; - + var $placeholder; $placeholders.each(function (index, placeholder) { $placeholder = $(placeholder); var timestamp = parseInt($placeholder.attr('data-comment-timestamp'), 10); @@ -40,6 +39,7 @@ var $placeholder = $(this); var commentTimestamp = parseInt($placeholder.attr('data-comment-timestamp'), 10); var nodeID = $placeholder.closest('[data-history-node-id]').attr('data-history-node-id'); + if (Drupal.history.needsServerCheck(nodeID, commentTimestamp)) { nodeIDs.push(nodeID); return true; diff --git a/core/modules/comment/js/node-new-comments-link.js b/core/modules/comment/js/node-new-comments-link.js index b7439940f61a..a3a821ddd140 100644 --- a/core/modules/comment/js/node-new-comments-link.js +++ b/core/modules/comment/js/node-new-comments-link.js @@ -21,7 +21,7 @@ function processNodeNewCommentLinks($placeholders) { var $placeholdersToUpdate = {}; var fieldName = 'comment'; - var $placeholder = void 0; + var $placeholder; $placeholders.each(function (index, placeholder) { $placeholder = $(placeholder); var timestamp = parseInt($placeholder.attr('data-history-node-last-comment-timestamp'), 10); @@ -35,8 +35,8 @@ remove($placeholder); } }); - var nodeIDs = Object.keys($placeholdersToUpdate); + if (nodeIDs.length === 0) { return; } @@ -56,7 +56,10 @@ $.ajax({ url: Drupal.url('comments/render_new_comments_node_links'), type: 'POST', - data: { 'node_ids[]': nodeIDs, field_name: fieldName }, + data: { + 'node_ids[]': nodeIDs, + field_name: fieldName + }, dataType: 'json', success: render }); @@ -70,9 +73,9 @@ var $placeholder = $(this); var lastCommentTimestamp = parseInt($placeholder.attr('data-history-node-last-comment-timestamp'), 10); var nodeID = $placeholder.closest('[data-history-node-id]').attr('data-history-node-id'); + if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) { nodeIDs.push(nodeID); - hide($placeholder); return true; } |