- 🇬🇧United Kingdom catch
+++ b/core/modules/contextual/contextual.module @@ -66,7 +67,11 @@ function contextual_page_attachments(array &$page) { } + $definitions = \Drupal::service('plugin.manager.menu.contextual_link')->getDefinitions(); + ksort($definitions); + $page['#attached']['library'][] = 'contextual/drupal.contextual-links'; + $page['#attached']['drupalSettings']['contextual']['linkDefinitionsHash'] = hash('sha256', Settings::getHashSalt() . implode(':', array_keys($definitions))); }
This looks like a good solution, but it needs a comment.
- Status changed to Needs review
almost 2 years ago 2:07pm 14 March 2023 - Status changed to Needs work
almost 2 years ago 11:35pm 21 March 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
-
+++ b/core/modules/contextual/contextual.module @@ -66,7 +67,13 @@ function contextual_page_attachments(array &$page) { + // Pass a hash of the current contextual link definitions to the javascript
nit: JavaScript
-
+++ b/core/modules/contextual/contextual.module @@ -66,7 +67,13 @@ function contextual_page_attachments(array &$page) { + $page['#attached']['drupalSettings']['contextual']['linkDefinitionsHash'] = hash('sha256', Settings::getHashSalt() . implode(':', array_keys($definitions)));
I don't know if we should be using the hash salt for this, its kind of leaking privileged data, we really only want a hash, doesn't need to be secure
-
+++ b/core/modules/contextual/js/contextual.js @@ -21,17 +21,31 @@ if (typeof permissionsHash === 'string') {
do we need the equivalent type check for the new hash?
-
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
+++ b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php @@ -67,6 +67,29 @@ public function testContextualLinksVisibility() { + protected function assertContextualLinkWithText(string $text) { + $contextLinks = $this->assertSession()->waitForElement('css', ".contextual-links li a"); + $this->assertNotEmpty($contextLinks); + foreach ($contextLinks as $contextLink) { + if ($contextLink->getText() === $text) { + break; + }
this doesn't fail if the link is missing, we need $this->fail() outside the loop
- Status changed to Needs review
almost 2 years ago 8:47pm 7 April 2023 - 🇺🇸United States smustgrave
#59
1 = fixed
2 = removed hash salt
3 = don't think we need it as there is a check before this code#60
1 = actually showed the tests weren't working and false positive. Updated tests. - 🇺🇸United States tim.plunkett Philadelphia
+++ b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php @@ -67,6 +67,14 @@ public function testContextualLinksVisibility() { + drupal_flush_all_caches();
Use
$this->resetAll()
instead (and maybe a line break after, for readability) - Status changed to Needs work
almost 2 years ago 3:34pm 8 April 2023 - 🇺🇸United States smustgrave
So #61 the tests pass with the cache clear.
Is the original goal to have contextual links appear without a cache clear?
Not sure if the tests or fix need work but should of got red/green
- 🇺🇸United States tim.plunkett Philadelphia
afaik, a cache clear currently doesn't fix the bug in any way, because it's stored in
sessionStorage
:while data in localStorage doesn't expire, data in sessionStorage is cleared when the page session ends
I'm not sure how best to ensure that a test is happening within the same page session. But that strikes me as the problem here
- 🇺🇸United States SocialNicheGuru
Number #54 patch no longer applies to Drupal 9.5.9.
- 🇬🇧United Kingdom james.williams
Here's a patch that applies to Drupal 9.5.x; just to assist those of us needing that. It includes the es6.js file and the transpiled version, since both are needed → in D9.5 patches as far as I can see.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
+++ b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php @@ -64,6 +64,14 @@ public function testContextualLinksVisibility() { + drupal_flush_all_caches();
Does the comment in #9 help? It might remove the need for this and get you a failing test?
- 🇷🇴Romania ion.macaria Bucharest, 🇷🇴
I know Drupal 9 is close to the end. But for last months maybe it is necessary for someone:
Drupal 9.5.11 patch. - last update
about 1 year ago Patch Failed to Apply - last update
about 1 year ago Custom Commands Failed - last update
about 1 year ago 30,341 pass - last update
about 1 year ago Custom Commands Failed - last update
about 1 year ago Custom Commands Failed - Status changed to Needs review
about 1 year ago 12:03pm 7 December 2023 - Status changed to Needs work
about 1 year ago 12:05pm 7 December 2023 The Needs Review Queue Bot → tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request → . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
- Merge request !5721Issue #2773591: New contextual links are not available after a module is installed → (Open) created by sourabhjain
- Status changed to Needs review
about 1 year ago 12:27pm 7 December 2023 - Status changed to Needs work
about 1 year ago 2:13pm 7 December 2023 - 🇺🇸United States smustgrave
Was tagged for issue summary which is still needed. Please don't put tickets in review without checking core gates and any open tags.
Now that we are mixing patches and MRs that will need to be cleaned up and noted in the updated issue summary.
- 🇺🇸United States steyep
I could not get the patch in #74 nor the diff from the MR to apply cleanly in 10.3. I've attached a re-rolled the patch for 10.3