- πΊπΈUnited States crystaldawn
Well, the patch in #33 didnt work for us at all. The masquerade block shows up for the admin user, but a normal user who has no access to that block to begin with cannot see the unmasquerade link and we're not about to give them access to the admin toolbar. Would it not make sense to make a 2nd block and a new permission called "unmasquerade" that can then be given to the "authorized user" role?
- π·π΄Romania claudiu.cristea Arad π·π΄
claudiu.cristea β made their first commit to this issueβs fork.
- @claudiucristea opened merge request.
- Status changed to Needs review
over 1 year ago 10:56am 18 May 2023 - π·π΄Romania claudiu.cristea Arad π·π΄
Added test coverage bu I have no idea why tests are not triggered or are no showing here. Any clue?
- π·π΄Romania claudiu.cristea Arad π·π΄
Adding a patch with teh same changes as in MR to see if we can run tests
- last update
over 1 year ago 5 pass - last update
over 1 year ago 5 pass - π«π·France andypost
Looks ready! just few questions and nits
-
+++ b/src/MasqueradeCallbacks.php @@ -70,4 +71,23 @@ class MasqueradeCallbacks implements TrustedCallbackInterface { + 'unmasquerade' => [ + '#type' => 'link', + '#title' => new TranslatableMarkup('Switch back'), + '#url' => Url::fromRoute('masquerade.unmasquerade'),
Would be great to pass here a destination for redirect
Wondering why you need 'unmasquerade' array key?! It looks useless
-
+++ b/src/MasqueradeCallbacks.php @@ -70,4 +71,23 @@ class MasqueradeCallbacks implements TrustedCallbackInterface { + return ['#markup' => ''];
as lazy builder it should return empty string instead of render array
-
+++ b/src/Plugin/Block/MasqueradeBlock.php @@ -99,6 +111,14 @@ class MasqueradeBlock extends BlockBase implements ContainerFactoryPluginInterfa public function build() { + if ($this->configuration['show_unmasquerade_link'] && $this->masquerade->isMasquerading()) { + return [ + 'unmasquerade' => [ + '#lazy_builder' => ['masquerade.callbacks:renderSwitchBackLink', []], + '#create_placeholder' => TRUE, + ], + ]; + } return $this->formBuilder->getForm(MasqueradeForm::class);
the same here - 'unmasquerade' looks useless
-
- last update
over 1 year ago 5 pass - last update
over 1 year ago 5 pass - πΊπΈUnited States crystaldawn
An array containing an array isnt "useless". It sounds to me like you're viewing it as an unused element and that's just not the case. Explain what makes it "useless".
- π«π·France andypost
Re @crystaldawn because render will needs useless iteration in both cases to render children but all we need is just a link or empty string from lazy builder. Moreover both render arrays are not alterable so no key needed
- Status changed to RTBC
over 1 year ago 3:56pm 18 May 2023 - π«π·France andypost
And that's why extra wrapper array still required to use "#type" π Lazy builder broken (#type defaults not loaded) Needs work
- last update
over 1 year ago 5 pass -
andypost β
committed 413e6378 on 8.x-2.x authored by
claudiu.cristea β
Issue #2900413 by heddn, andypost, claudiu.cristea, jrb, liquidcms:...
-
andypost β
committed 413e6378 on 8.x-2.x authored by
claudiu.cristea β
- Status changed to Fixed
over 1 year ago 10:02pm 26 July 2023 - π«π·France andypost
Commited to 8.x-2.x, thank you
Created new release https://www.drupal.org/project/masquerade/releases/8.x-2.0-rc2 β
- πΊπΈUnited States DanChadwick
Note that the release note for 8.x-2.0-rc2 indicates that it includes this issue, which it does not. The commit for this issue was made after 8.x-2.0-rc1 was tagged and released. Ideally the release note should be edited to remove it.
- π«π·France andypost
@DanChadwick thank you! fixed rc2 release and created https://www.drupal.org/project/masquerade/releases/8.x-2.0-rc3 β
Untested, but from reviewing the code, just thought to confirm if this code snippet was correct?
+ if (isset($configuration['show_unmasquerade_link'])) { + $block->getPlugin()->setConfigurationValue('show_unmasquerade_link', FALSE); + return TRUE; + }
Shouldn't it be
if (!isset($configuration['show_unmasquerade_link']))
instead?- πΊπΈUnited States DamienMcKenna NH, USA
Like so?
Do we need another post-update script to fix this mistake?
I'm not sure if there's an easy way to address this with another post update hook, the best bet is to just put in the hotfix as quickly as possible to mitigate the damage.
- πΊπΈUnited States DamienMcKenna NH, USA
Do we want a new critical issue for the patch or is #58 sufficient for now?
-
andypost β
committed c6b0cde5 on 8.x-2.x authored by
DamienMcKenna β
Issue #2900413 by DamienMcKenna: Follow-up for Allow UnMasquerade link...
-
andypost β
committed c6b0cde5 on 8.x-2.x authored by
DamienMcKenna β
- π«π·France andypost
Thank you! created new release https://www.drupal.org/project/masquerade/releases/8.x-2.0-rc4 β
Automatically closed - issue fixed for 2 weeks with no activity.