Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / comment / src / CommentViewBuilder.php
index 51a9185853659df3d3123df4705c159812e1dc20..bac67f1b4868b02ceb5c311742c5084ca4f463f3 100644 (file)
@@ -98,6 +98,7 @@ class CommentViewBuilder extends EntityViewBuilder {
 
     // A counter to track the indentation level.
     $current_indent = 0;
+    $attach_history = $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated();
 
     foreach ($entities as $id => $entity) {
       if ($build[$id]['#comment_threaded']) {
@@ -143,7 +144,7 @@ class CommentViewBuilder extends EntityViewBuilder {
         $build[$id]['#attached'] = [];
       }
       $build[$id]['#attached']['library'][] = 'comment/drupal.comment-by-viewer';
-      if ($this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated()) {
+      if ($attach_history && $commented_entity->getEntityTypeId() === 'node') {
         $build[$id]['#attached']['library'][] = 'comment/drupal.comment-new-indicator';
 
         // Embed the metadata for the comment "new" indicators on this node.