Loading core/modules/comment/src/CommentLazyBuilders.php +2 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,8 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment ]; } $field_definition = $commented_entity->getFieldDefinition($entity->getFieldName()); if ($entity->access('create') if ($entity->isPublished() && $entity->access('create') && $field_definition->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_THREADED) { $links['comment-reply'] = [ 'title' => t('Reply'), Loading core/modules/comment/tests/src/Functional/CommentThreadingTest.php +25 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,31 @@ class CommentThreadingTest extends CommentTestBase { */ protected $defaultTheme = 'stark'; /** * Check the reply link on unpublished comments. */ public function testCommentReplyLinkUnpublished(): void { // Set comments to have a subject with preview disabled. $this->setCommentPreview(DRUPAL_DISABLED); $this->setCommentForm(FALSE); $this->setCommentSettings('default_mode', CommentManagerInterface:: COMMENT_MODE_THREADED, 'Comment paging changed.'); // Create a node. $this->drupalLogin($this->adminUser); $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id()]); // Post comment #1. $comment_text = $this->randomMachineName(); $comment1 = $this->postComment($this->node, $comment_text, '', TRUE); $this->drupalGet($this->node->toUrl()); $this->assertSession()->pageTextContains('Reply'); $comment1->setUnpublished(); $comment1->save(); $this->drupalGet($this->node->toUrl()); $this->assertSession()->pageTextNotContains('Reply'); } /** * Tests the comment threading. */ Loading @@ -33,7 +58,6 @@ public function testCommentThreading(): void { $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id()]); // Post comment #1. $this->drupalLogin($this->webUser); $subject_text = $this->randomMachineName(); $comment_text = $this->randomMachineName(); Loading Loading
core/modules/comment/src/CommentLazyBuilders.php +2 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,8 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment ]; } $field_definition = $commented_entity->getFieldDefinition($entity->getFieldName()); if ($entity->access('create') if ($entity->isPublished() && $entity->access('create') && $field_definition->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_THREADED) { $links['comment-reply'] = [ 'title' => t('Reply'), Loading
core/modules/comment/tests/src/Functional/CommentThreadingTest.php +25 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,31 @@ class CommentThreadingTest extends CommentTestBase { */ protected $defaultTheme = 'stark'; /** * Check the reply link on unpublished comments. */ public function testCommentReplyLinkUnpublished(): void { // Set comments to have a subject with preview disabled. $this->setCommentPreview(DRUPAL_DISABLED); $this->setCommentForm(FALSE); $this->setCommentSettings('default_mode', CommentManagerInterface:: COMMENT_MODE_THREADED, 'Comment paging changed.'); // Create a node. $this->drupalLogin($this->adminUser); $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id()]); // Post comment #1. $comment_text = $this->randomMachineName(); $comment1 = $this->postComment($this->node, $comment_text, '', TRUE); $this->drupalGet($this->node->toUrl()); $this->assertSession()->pageTextContains('Reply'); $comment1->setUnpublished(); $comment1->save(); $this->drupalGet($this->node->toUrl()); $this->assertSession()->pageTextNotContains('Reply'); } /** * Tests the comment threading. */ Loading @@ -33,7 +58,6 @@ public function testCommentThreading(): void { $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id()]); // Post comment #1. $this->drupalLogin($this->webUser); $subject_text = $this->randomMachineName(); $comment_text = $this->randomMachineName(); Loading