Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!10978
Issue
#3130197
: Faulty toolbar subtree hash breaks asynchonous loading of admin menu content
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3130197
: Faulty toolbar subtree hash breaks asynchonous loading of admin menu content
issue/drupal-3130197:3130197-faulty-toolbar-subtree
into
11.x
Overview
0
Commits
1
Pipelines
1
Changes
2
Open
sleitner
requested to merge
issue/drupal-3130197:3130197-faulty-toolbar-subtree
into
11.x
4 months ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
Closes
#3130197
0
0
Merge request reports
Compare
11.x
11.x (HEAD)
and
latest version
latest version
a1ad81f6
1 commit,
4 months ago
2 files
+
11
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
core/modules/toolbar/src/Controller/ToolbarController.php
+
10
−
5
Options
@@ -31,14 +31,20 @@ public function __construct(
/**
* Returns an AJAX response to render the toolbar subtrees.
*
* @param string $hash
* The hash of the toolbar subtrees.
*
* @return \Drupal\Core\Ajax\AjaxResponse
* The AJAX response containing the rendered toolbar subtrees.
*/
public
function
subtreesAjax
()
{
public
function
subtreesAjax
(
$hash
)
{
[
$subtrees
]
=
toolbar_get_rendered_subtrees
();
$response
=
new
AjaxResponse
();
$response
->
addCommand
(
new
SetSubtreesCommand
(
$subtrees
));
$expected_hash
=
_toolbar_get_subtrees_hash
()[
0
];
$response
=
new
AjaxResponse
();
if
(
hash_equals
(
$expected_hash
,
$hash
))
{
$response
->
addCommand
(
new
SetSubtreesCommand
(
$subtrees
));
}
// The Expires HTTP header is the heart of the client-side HTTP caching. The
// additional server-side page cache only takes effect when the client
// accesses the callback URL again (e.g., after clearing the browser cache
@@ -64,8 +70,7 @@ public function subtreesAjax() {
* The access result.
*/
public
function
checkSubTreeAccess
(
$hash
)
{
$expected_hash
=
_toolbar_get_subtrees_hash
()[
0
];
return
AccessResult
::
allowedIf
(
$this
->
currentUser
()
->
hasPermission
(
'access toolbar'
)
&&
hash_equals
(
$expected_hash
,
$hash
))
->
cachePerPermissions
();
return
AccessResult
::
allowedIf
(
$this
->
currentUser
()
->
hasPermission
(
'access toolbar'
))
->
cachePerPermissions
();
}
/**
Loading