Skip to content
Snippets Groups Projects
Unverified Commit 371936c4 authored by Alex Pott's avatar Alex Pott
Browse files

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

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

(cherry picked from commit 44f56c2c)
parent 7769a956
No related branches found
No related tags found
6 merge requests!12227Issue #3181946 by jonmcl, mglaman,!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete
Pipeline #477178 passed
Pipeline: drupal

#477180

    ......@@ -3,6 +3,7 @@
    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;
    ......@@ -199,7 +200,7 @@ public function revisionOverview(NodeInterface $node) {
    ],
    ];
    // @todo Simplify once https://www.drupal.org/node/2334319 lands.
    $this->renderer->addCacheableDependency($column['data'], $username);
    $this->renderer->addCacheableDependency($column['data'], CacheableMetadata::createFromRenderArray($username));
    $row[] = $column;
    if ($is_current_revision) {
    ......
    ......@@ -217,4 +217,20 @@ 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');
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment