Unverified Commit 1926ec30 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3214487 by paulocs, vakulrai, vetal4ik, manojithape, nishantghetiya,...

Issue #3214487 by paulocs, vakulrai, vetal4ik, manojithape, nishantghetiya, quietone, Lendude: Remove 'reply' link from comment field when threading is disabled
parent 5be50483
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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', [
+11 −0
Original line number Diff line number Diff line
@@ -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;

@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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]');