Issue #2554585 by Wim Leers, effulgentsia, moshe weitzman: Tracker responses are missing a cache tag and a cache context
parent
66e453aa1b
commit
f0ba2d7c8e
|
@ -84,7 +84,8 @@ class TrackerTest extends WebTestBase {
|
|||
$this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
|
||||
|
||||
// Assert cache contexts, specifically the pager and node access contexts.
|
||||
$this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user.node_grants:view', 'user.permissions']);
|
||||
$this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user.node_grants:view', 'user.permissions', 'user.roles:authenticated']);
|
||||
// Assert cache tags for the visible node and node list cache tag.
|
||||
$expected_tags = Cache::mergeTags($published->getCacheTags(), $published->getOwner()->getCacheTags());
|
||||
$expected_tags = Cache::mergeTags($expected_tags, ['node_list', 'rendered']);
|
||||
$this->assertCacheTags($expected_tags);
|
||||
|
|
|
@ -140,8 +140,13 @@ function tracker_page($account = NULL) {
|
|||
$page['#cache']['tags'] = $cache_tags;
|
||||
$page['#cache']['contexts'][] = 'user.node_grants:view';
|
||||
|
||||
if (Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) {
|
||||
$page['#attached']['library'][] = 'tracker/history';
|
||||
// Display the reading history if that module is enabled.
|
||||
if (\Drupal::moduleHandler()->moduleExists('history')) {
|
||||
// Reading history is tracked for authenticated users only.
|
||||
if (\Drupal::currentUser()->isAuthenticated()) {
|
||||
$page['#attached']['library'][] = 'tracker/history';
|
||||
}
|
||||
$page['#cache']['contexts'][] = 'user.roles:authenticated';
|
||||
}
|
||||
|
||||
return $page;
|
||||
|
|
Loading…
Reference in New Issue