core/modules/book/src/Plugin/Block/BookNavigationBlock.php | 2 +- core/modules/help/src/Plugin/Block/HelpBlock.php | 4 +++- core/modules/node/src/Tests/NodeTranslationUITest.php | 3 +-- core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php | 4 +--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php index 216f69b..846c285 100644 --- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php +++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php @@ -183,7 +183,7 @@ public function build() { * {@inheritdoc} */ public function getCacheContexts() { - return Cache::mergeContexts(parent::getCacheContexts(), ['route.book_navigation']); + return Cache::mergeContexts(parent::getCacheContexts(), ['user.roles', 'route.book_navigation']); } /** diff --git a/core/modules/help/src/Plugin/Block/HelpBlock.php b/core/modules/help/src/Plugin/Block/HelpBlock.php index 84038ed..cae2b6e 100644 --- a/core/modules/help/src/Plugin/Block/HelpBlock.php +++ b/core/modules/help/src/Plugin/Block/HelpBlock.php @@ -119,7 +119,9 @@ public function build() { * {@inheritdoc} */ public function getCacheContexts() { - return Cache::mergeContexts(parent::getCacheContexts(), ['route']); + // The "Help" block must be cached per URL: help is defined for a + // given path, and does not come with any access restrictions. + return Cache::mergeContexts(parent::getCacheContexts(), ['url']); } } diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php index ec257ea..b42eb76 100644 --- a/core/modules/node/src/Tests/NodeTranslationUITest.php +++ b/core/modules/node/src/Tests/NodeTranslationUITest.php @@ -30,8 +30,7 @@ class NodeTranslationUITest extends ContentTranslationUITestBase { 'theme', 'route', 'timezone', - 'url.path', - 'url.query_args:_wrapper_format', + 'url', 'user' ]; diff --git a/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php index a5e14b2..22ae7b2 100644 --- a/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php @@ -7,7 +7,6 @@ namespace Drupal\page_cache\Tests; -use Drupal\Core\EventSubscriber\MainContentViewSubscriber; use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait; @@ -78,8 +77,7 @@ function testPageCacheTags() { 'user', // The placed block is only visible on certain URLs through a visibility // condition. - 'url.path', - 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, + 'url', ]; // Full node page 1.