From 18bbe3a788daff889bea02fd7bf250a37f7133c2 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 25 Jun 2014 19:13:06 -0700 Subject: [PATCH] Issue #2289095 by larowlan | pingers: Fixed Frontpage view, feed display renders the node comment form. --- .../config/install/views.view.frontpage.yml | 2 +- .../standard/src/Tests/StandardTest.php | 27 ++++++++++++++++++- core/profiles/standard/standard.install | 5 ++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/core/modules/node/config/install/views.view.frontpage.yml b/core/modules/node/config/install/views.view.frontpage.yml index d03ea99a0a7..dd257b5bc34 100644 --- a/core/modules/node/config/install/views.view.frontpage.yml +++ b/core/modules/node/config/install/views.view.frontpage.yml @@ -229,7 +229,7 @@ display: type: node_rss options: relationship: none - item_length: default + item_length: rss links: false provider: views label: Frontpage diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index 9857b8362b8..3a1eeadef58 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -7,6 +7,7 @@ namespace Drupal\standard\Tests; +use Drupal\comment\Entity\Comment; use Drupal\simpletest\WebTestBase; /** @@ -34,7 +35,11 @@ class StandardTest extends WebTestBase { $this->assertResponse(200); // Test anonymous user can access 'Main navigation' block. - $admin = $this->drupalCreateUser(array('administer blocks')); + $admin = $this->drupalCreateUser(array( + 'administer blocks', + 'post comments', + 'skip comment approval', + )); $this->drupalLogin($admin); // Configure the block. $this->drupalGet('admin/structure/block/add/system_menu_block:main/bartik'); @@ -67,6 +72,26 @@ class StandardTest extends WebTestBase { $this->drupalLogout(); $this->assertText('Main navigation'); + // Ensure comments don't show in the front page RSS feed. + // Create an article. + $node = $this->drupalCreateNode(array( + 'type' => 'article', + 'title' => 'Foobar', + 'promote' => 1, + 'status' => 1, + )); + + // Add a comment. + $this->drupalLogin($admin); + $this->drupalGet('node/1'); + $this->drupalPostForm(NULL, array( + 'subject' => 'Barfoo', + 'comment_body[0][value]' => 'Then she picked out two somebodies, Sally and me', + ), t('Save')); + // Fetch the feed. + $this->drupalGet('rss.xml'); + $this->assertText('Foobar'); + $this->assertNoText('Then she picked out two somebodies, Sally and me'); } } diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index b9d1c02dbea..f588cd3e7de 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -20,6 +20,11 @@ function standard_install() { // Add comment field to article node type. \Drupal::service('comment.manager')->addDefaultField('node', 'article', 'comment', CommentItemInterface::OPEN); + // Hide the comment field in the rss view mode. + entity_get_display('node', 'article', 'rss') + ->removeComponent('comment') + ->save(); + // Allow visitor account creation with administrative approval. $user_settings = \Drupal::config('user.settings'); $user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();