reverted: --- b/modules/comment/comment.module +++ a/modules/comment/comment.module @@ -730,12 +730,10 @@ $comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50); if ($cids = comment_get_thread($node, $mode, $comments_per_page)) { $comments = comment_load_multiple($cids); + comment_prepare_thread($comments); + $build = comment_view_multiple($comments, $node); + $build['pager']['#theme'] = 'pager'; + $additions['comments'] = $build; - if ($comments) { - comment_prepare_thread($comments); - $build = comment_view_multiple($comments, $node); - $build['pager']['#theme'] = 'pager'; - $additions['comments'] = $build; - } } } @@ -1358,11 +1356,9 @@ $comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50); if ($node->comment && $cids = comment_get_thread($node, $mode, $comments_per_page)) { $comments = comment_load_multiple($cids); + comment_prepare_thread($comments); + $build = comment_view_multiple($comments, $node); + return drupal_render($build); - if ($comments) { - comment_prepare_thread($comments); - $build = comment_view_multiple($comments, $node); - return drupal_render($build); - } } } return ''; reverted: --- b/modules/comment/comment.test +++ a/modules/comment/comment.test @@ -2223,57 +2223,3 @@ $this->assertFalse(comment_load($comment->id), 'The comment could not be loaded after the node was deleted.'); } } - -/** - * Tests the behavior of comments when the comment author is deleted. - */ -class CommentAuthorDeletionTestCase extends CommentHelperCase { - public static function getInfo() { - return array( - 'name' => 'Comment author deletion', - 'description' => 'Test the behavior of comments when the comment author is deleted.', - 'group' => 'Comment', - ); - } - - /** - * Tests that comments are correctly deleted when their author is deleted. - */ - function testAuthorDeletion() { - // Create a comment as the admin user. - $this->drupalLogin($this->admin_user); - $comment = $this->postComment($this->node, $this->randomName()); - $this->assertTrue($this->commentExists($comment), t('Comment is displayed initially.')); - $this->drupalLogout(); - - // Delete the admin user, and check that the node which displays the - // comment can still be viewed, but the comment itself does not appear - // there. - user_delete($this->admin_user->uid); - $this->drupalGet('node/' . $this->node->nid); - $this->assertResponse(200, t('Node page is accessible after the comment author is deleted.')); - $this->assertFalse($this->commentExists($comment), t('Comment is not displayed after the comment author is deleted.')); - } - - /** - * Test comment author deletion while the comment module is disabled. - */ - function testAuthorDeletionCommentModuleDisabled() { - // Create a comment as the admin user. - $this->drupalLogin($this->admin_user); - $comment = $this->postComment($this->node, $this->randomName()); - $this->assertTrue($this->commentExists($comment), t('Comment is displayed initially.')); - $this->drupalLogout(); - - // Delete the admin user while the comment module is disabled, and ensure - // that the missing comment author is still handled correctly (the node - // itself should be displayed, but the comment should not be displayed on - // it). - module_disable(array('comment')); - user_delete($this->admin_user->uid); - module_enable(array('comment')); - $this->drupalGet('node/' . $this->node->nid); - $this->assertResponse(200, t('Node page is accessible after the comment author is deleted.')); - $this->assertFalse($this->commentExists($comment), t('Comment is not displayed after the comment author is deleted.')); - } -} only in patch2: unchanged: --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -910,7 +910,12 @@ function comment_node_update_index(EntityInterface $node, $langcode) { $comments_per_page = $field_definition->getSetting('per_page'); if ($node->get($field_name)->status && $cids = comment_get_thread($node, $field_name, $mode, $comments_per_page)) { $comments = entity_load_multiple('comment', $cids); + if ($comments) { comment_prepare_thread($comments); + $build = comment_view_multiple($comments, $node); + $build['pager']['#theme'] = 'pager'; + $additions['comments'] = $build; + } $build = comment_view_multiple($comments); $return .= drupal_render($build); }