diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 1081ed4..85a9ace 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -350,9 +350,6 @@ function comment_get_recent($number = 10) { ->condition('n.default_langcode', 1); } $comments = $query - ->orderBy('c.created', 'DESC') - // Additionally order by cid to ensure that comments with the same timestamp - // are returned in the exact order posted. ->orderBy('c.cid', 'DESC') ->range(0, $number) ->execute() diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php index 61ce22b..931611c 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php @@ -90,6 +90,19 @@ function testRecentCommentBlock() { $this->assertText($comment3->comment_body->value, 'Comment found in block.'); $this->assertText($comment4->subject->value, 'Comment found in block.'); + // Edit an older comment (comment 3) and change body. + $this->drupalLogout(); + $this->drupalLogin($this->admin_user); + $edit = array(); + $edit['comment_body[0][value]'] = $this->randomName(); + $this->drupalGet('comment/' . $comment3->id() . '/edit'); + $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalLogout(); + $this->drupalLogin($this->web_user); + + // Test that editing did not change the order of comment 4 and comment 3. + $this->assertTrue(strpos($this->drupalGetContent(), $comment4->subject->value) < strpos($this->drupalGetContent(), $comment3->comment_body->value), 'Comment order was retained in the order of posting even after editing an earlier comment.'); + // Test that links to comments work when comments are across pages. $this->setCommentsPerPage(1); $this->drupalGet('');