Commit 80dbf1cb authored by catch's avatar catch
Browse files

Revert "Issue #3227637 by larowlan, acbramley, daffie, amber himes matz,...

Revert "Issue #3227637 by larowlan, acbramley, daffie, amber himes matz, yogeshmpawar, fubarhouse, chetanbharambe, jibran, catch, kristen pol, alexpott: NodeController::revisionOverview is uncacheable"

This reverts commit 44f56c2c.

(cherry picked from commit 66097f2a)
parent 63be8a86
Loading
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Drupal\node\Controller;

use Drupal\Component\Utility\Xss;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
@@ -200,7 +199,7 @@ public function revisionOverview(NodeInterface $node) {
          ],
        ];
        // @todo Simplify once https://www.drupal.org/node/2334319 lands.
        $this->renderer->addCacheableDependency($column['data'], CacheableMetadata::createFromRenderArray($username));
        $this->renderer->addCacheableDependency($column['data'], $username);
        $row[] = $column;

        if ($is_current_revision) {
+0 −16
Original line number Diff line number Diff line
@@ -217,20 +217,4 @@ public function testNodeDuplicateRevisionsTab(): void {
    $this->assertSession()->elementsCount('xpath', $xpath, 1);
  }

  /**
   * Tests the node revisions page is cacheable by dynamic page cache.
   */
  public function testNodeRevisionsCacheability(): void {
    $this->drupalLogin($this->editor);
    $node = $this->drupalCreateNode();
    // Admin paths are always uncacheable by dynamic page cache, swap node
    // to non admin theme to test cacheability.
    $this->config('node.settings')->set('use_admin_theme', FALSE)->save();
    \Drupal::service('router.builder')->rebuild();
    $this->drupalGet($node->toUrl('version-history'));
    $this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'MISS');
    $this->drupalGet($node->toUrl('version-history'));
    $this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'HIT');
  }

}