diff --git a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php index 3661080..9e6e68b 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php @@ -312,7 +312,8 @@ protected function alterBuild(array &$build, EntityInterface $comment, EntityVie */ public static function attachNewCommentsLinkMetadata(array $element, array $context) { // Build "X new comments" link metadata. - $new = (int)comment_num_new($context['entity_id'], $context['entity_type']); + $new = \Drupal::service('comment.manager') + ->getCountNewComments(entity_load($context['entity_type'], $context['entity_id'])); // Early-return if there are zero new comments for the current user. if ($new === 0) { return $element;