Loading core/modules/comment/src/CommentLazyBuilders.php +3 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,9 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment 'url' => $entity->toUrl('edit-form'), ]; } if ($entity->access('create')) { $field_definition = $commented_entity->getFieldDefinition($entity->getFieldName()); if ($entity->access('create') && $field_definition->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_THREADED) { $links['comment-reply'] = [ 'title' => t('Reply'), 'url' => Url::fromRoute('comment.reply', [ Loading core/modules/comment/tests/src/Functional/CommentLinksTest.php +11 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; use Drupal\comment\CommentManagerInterface; use Drupal\user\RoleInterface; use Drupal\comment\Entity\Comment; Loading Loading @@ -76,6 +77,16 @@ public function testCommentLinks() { $comment->save(); $this->comment = $comment; // Tests that reply link is not visible when threading is disabled. $this->drupalLogin($this->webUser); $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.'); $this->drupalGet('node/' . $this->node->id()); $this->assertSession()->linkNotExists('Reply'); // Tests that reply link is visible when threading is enabled. $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.'); $this->drupalGet('node/' . $this->node->id()); $this->assertSession()->linkExists('Reply'); // Change comment settings. $this->setCommentSettings('form_location', CommentItemInterface::FORM_BELOW, 'Set comment form location'); $this->setCommentAnonymous(TRUE); Loading core/modules/forum/tests/src/Functional/ForumTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -542,8 +542,8 @@ public function testForumWithNewPost() { $this->submitForm($edit, 'Save'); $this->assertSession()->statusCodeEquals(200); // Test replying to a comment. $this->clickLink('Reply'); // Test adding a new comment. $this->clickLink('Add new comment'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->fieldExists('comment_body[0][value]'); Loading Loading
core/modules/comment/src/CommentLazyBuilders.php +3 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,9 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment 'url' => $entity->toUrl('edit-form'), ]; } if ($entity->access('create')) { $field_definition = $commented_entity->getFieldDefinition($entity->getFieldName()); if ($entity->access('create') && $field_definition->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_THREADED) { $links['comment-reply'] = [ 'title' => t('Reply'), 'url' => Url::fromRoute('comment.reply', [ Loading
core/modules/comment/tests/src/Functional/CommentLinksTest.php +11 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; use Drupal\comment\CommentManagerInterface; use Drupal\user\RoleInterface; use Drupal\comment\Entity\Comment; Loading Loading @@ -76,6 +77,16 @@ public function testCommentLinks() { $comment->save(); $this->comment = $comment; // Tests that reply link is not visible when threading is disabled. $this->drupalLogin($this->webUser); $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.'); $this->drupalGet('node/' . $this->node->id()); $this->assertSession()->linkNotExists('Reply'); // Tests that reply link is visible when threading is enabled. $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.'); $this->drupalGet('node/' . $this->node->id()); $this->assertSession()->linkExists('Reply'); // Change comment settings. $this->setCommentSettings('form_location', CommentItemInterface::FORM_BELOW, 'Set comment form location'); $this->setCommentAnonymous(TRUE); Loading
core/modules/forum/tests/src/Functional/ForumTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -542,8 +542,8 @@ public function testForumWithNewPost() { $this->submitForm($edit, 'Save'); $this->assertSession()->statusCodeEquals(200); // Test replying to a comment. $this->clickLink('Reply'); // Test adding a new comment. $this->clickLink('Add new comment'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->fieldExists('comment_body[0][value]'); Loading