Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
quickedit_preprocess_page_title(&$variables)
does not check whether the current user has access in-place editing
permission, thus resulting in having the class show in the markup even when it shouldn't.
Proposed resolution
Check whether the current user has access in-place editing
permission in order to add the class.
Remaining tasks
Do it.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#20 | 2787471-20.patch | 2.56 KB | omitsis |
#14 | 2787471-14.patch | 2.11 KB | omitsis |
#14 | 2787471-14-tests-should-fail.patch | 1.46 KB | omitsis |
#5 | 2787471-5.patch | 662 bytes | darketaine |
#3 | after-with-permission.png | 81.82 KB | darketaine |
Comments
Comment #2
thpoul CreditAttribution: thpoul at Pixual commentedAnd here is the patch.
Comment #3
darketaine CreditAttribution: darketaine at Pixual commentedI confirm the problem and that the patch solves it without creating problem when the user has permission for in-place editing.
I attach screenshots before (both with and without in-place editing permission) and after
Comment #4
catchGiven the preprocess is currently a one-liner, let's avoid the negative condition and early return, and add the class inside the if instead.
Comment #5
darketaine CreditAttribution: darketaine at Pixual commentedHere is the patch according to #4
Comment #6
thpoul CreditAttribution: thpoul at Pixual commentedThank you @catch & @darketaine, back to RTBC.
Comment #7
alexpottLucky permissions are a permanent cache context otherwise this sort of variability in a template is tricky. How given this is a condition on a permission we should test it.
Comment #9
Wim LeersComment #10
Wim LeersWe can easily add two simple assertions to
\Drupal\quickedit\Tests\QuickEditLoadingTest::testUserWithoutPermission()
and\Drupal\quickedit\Tests\QuickEditLoadingTest::testUserWithPermission()
.Comment #11
omitsis CreditAttribution: omitsis commentedOK. Go with tests!
Comment #14
omitsis CreditAttribution: omitsis commentedOh sorry! Now with correct xpath.
Comment #16
omitsis CreditAttribution: omitsis at Omitsis Consulting SL commentedComment #17
oriol_e9gTest fail, fix pass.
Point at the end of the sentence, can be fixed on commit.
Comment #18
Wim LeersThis is a sister issue of #2528498: Only emit Quick Edit data- attributes when actually necessary.
Comment #19
Wim LeersTests have been added.
This is missing a cache context. See the patch at #2528498-23: Only emit Quick Edit data- attributes when actually necessary.
This sentence does not make sense. Let's use the same sentence as #2528498-23: Only emit Quick Edit data- attributes when actually necessary uses.
Let's omit the messages here, because they don't make a lot of sense (and adding such messages doesn't add much value anyway).
Let's use the same sentence as #2528498-23: Only emit Quick Edit data- attributes when actually necessary uses.
Comment #20
omitsis CreditAttribution: omitsis at Omitsis Consulting SL commentedMaybe we can merge two comments in one? :)
Comment #21
oriol_e9gGo again.
Comment #22
alexpottCommitted 10210c7 and pushed to 8.3.x. Thanks!