Commit 7bd926f6 authored by alexpott's avatar alexpott

Issue #2729211 by catch, Wim Leers: node_query_node_access_alter() should only...

Issue #2729211 by catch, Wim Leers: node_query_node_access_alter() should only add cacheability on GET/HEAD
parent bc084e18
...@@ -1081,8 +1081,9 @@ function node_query_node_access_alter(AlterableInterface $query) { ...@@ -1081,8 +1081,9 @@ function node_query_node_access_alter(AlterableInterface $query) {
// Bubble the 'user.node_grants:$op' cache context to the current render // Bubble the 'user.node_grants:$op' cache context to the current render
// context. // context.
$request = \Drupal::requestStack()->getCurrentRequest();
$renderer = \Drupal::service('renderer'); $renderer = \Drupal::service('renderer');
if ($renderer->hasRenderContext()) { if ($request->isMethodSafe() && $renderer->hasRenderContext()) {
$build = ['#cache' => ['contexts' => ['user.node_grants:' . $op]]]; $build = ['#cache' => ['contexts' => ['user.node_grants:' . $op]]];
$renderer->render($build); $renderer->render($build);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment