Needs review
Project:
Quick Edit
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 May 2014 at 21:24 UTC
Updated:
28 Jan 2022 at 11:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
xjmComment #2
xjmComment #3
wim leersComment #5
wim leers#3 will apply once #2287071: Add cacheability metadata to access checks has landed. Postponing on #2287071: Add cacheability metadata to access checks.
Comment #6
mgiffordComment #7
wim leersRerolled.
Comment #8
wim leersOops, I lost the changes to the interface in my reroll.
Thanks @nod_ for notifying me of that in IRC.
Comment #9
nod_all good now.
Comment #14
wim leersIn the patch above I stupidly copied the changes from #3, without taking into account the additional parameters that this specified. Brought those back, that hugely diminishes the number of failures.
Comment #15
wim leersAnd to pass the current user to the access check, some other things need to be updated as well.
Comment #21
wim leers#2267621: Deprecate and rename EditEntityFieldAccessCheck now that the module is named Quick Edit is in, this needs a reroll.
Comment #22
himanshu-dixit commentedHere is the patch, that i rerolled.
Comment #24
swarad07Comment #25
wim leers#24 Please provide an interdiff. See https://www.drupal.org/documentation/git/interdiff.
Comment #26
swarad07Attaching interdiff between 15 and 24.
Comment #27
swarad07Comment #28
wim leers#2267621: Deprecate and rename EditEntityFieldAccessCheck now that the module is named Quick Edit was only committed to 8.4.x. This issue was still on 8.3.x. The patch in #24 hence does not apply to 8.4.x.
Sorry for not noticing that sooner.
Comment #29
aries commentedUpgraded #24 against 8.4.x.
Comment #30
aries commentedComment #31
wim leersNit: Adding this newline is not necessary.
RTBC, because that silly nit can be fixed upon commit. Or not be fixed at all.
Thanks!
Comment #32
alexpottWhy is this removed? We need some documentation - I think it shouldn't be removed.
Adding a new parameter with no default is a BC break - are we sure this is ok?
Shouldn't we implement this in a BC compatible manor and fallback to the current user and default to NULL. We can only add a required argument to an interface like this in D9.
Comment #33
wim leersTwo things:
Hence I'm asking: do we need to be this strict for something like this? Something that A) should have been marked
@internalbut isn't, and B) is extremely unlikely to be used by anything else?Don't get me wrong: I agree with everything you said in principle. But in practice, it makes no difference.
Comment #34
wim leersBriefly discussed with @alexpott in IRC. We agreed on this:
So, @aries, you'll need to make sure to not require the new parameter to be specified. It'll need to be optional.
Comment #35
aries commentedSorry for the delay, let me know if I missed something.
@wim-leers: I removed the unnecessary extra line.
Comment #36
aries commentedComment #37
aries commentedThe default value was missing in the MetadataGenerator's constructor.
- In the unit-tests, do we need to keep the test cases against the old signatures along with the new ones?
- Shall I add a @TODO to remove the default value in 8.5.x?
Comment #38
aries commentedMethod documentation update - $current_user is optional.
Comment #42
aries commentedMethod MockQuickEditEntityFieldAccessCheck::accessEditEntityField() 's signature amended to match with the interface.
Comment #43
wim leersCould you provide interdiffs in the future? See https://www.drupal.org/documentation/git/interdiff.
$this->currentUsermight beNULL.If that's the case, we need to retrieve the current user service from the container. Otherwise we're still breaking BC.
Comment #44
keeneganI've added this
before
Comment #45
wim leersPlease provide an interdiff: https://www.drupal.org/documentation/git/interdiff
Comment #46
vijaycs85Reg #43:
@current_user injected in the service as an argument in services.yml file. If it is empty eventually it's going to be empty in container as well. Am I missing something here?
@current_user in service.yml == Drupal::currentUser() right?
Comment #47
wim leersShould be ===.
Should have a leading backslash.
But those are trivial fixes that can be made upon commit.
Thanks all!
Comment #48
dinesh18 commentedHere is an updated Patch which fixed the comments mentioned in #47.
Comment #49
wim leers@Dinesh18: Thanks, but please also upload an interdiff then. Otherwise I have to manually compare every single change. See https://www.drupal.org/documentation/git/interdiff.
Comment #50
dinesh18 commentedThanks @Wim Leers
I will provide the interdiff.
Comment #51
dinesh18 commentedHere is the interdiffs and the patch
Comment #52
dinesh18 commentedignore comment #51. patch name written is wrong.
Here is an updated one.
Comment #53
wim leersThanks, @Dinesh18!
Comment #54
larowlanWe normally use \Drupal instead of adding a use statement for classes in the global namespace
Comment #55
wim leersOops, I missed that. Thanks. #44 introduced that. This is why we want interdiffs!
Comment #56
dinesh18 commentedComment #57
dinesh18 commentedHere is an updated patch and interdiff which implements #54
Comment #58
wim leersSorry for not being more clear: we don't need that line! Can you just remove it altogether? Thanks :)
Comment #59
dinesh18 commentedNo issues. I am new to Drupal 8. By the way #54 states clearly that we should not use \Drupal instead we should use it as a global namespace. Hope I am correct :)
Here is an updated patch with interdiff
Comment #60
dinesh18 commentedComment #61
wim leersPerfect, thank you!
Comment #62
larowlanUpdating issue credit, giving @alexpott credit for picking up the BC break and @vijaycs85 for picking up the question in #46
Comment #63
larowlanI agree with @vijaycs85 in #46- in what circumstances would this be NULL?
Comment #64
wim leers#63:
Because this is an optional new parameter. And therefore subclasses may not yet have.
OTOH, this is just ensuring there is a
currentUserservice to pass to::accessEditEntityField()which itself already allowsNULLto be passed for similar BC reasons.So I agree that this if-test is pointless and can be removed.
Comment #66
ivan berezhnov commentedComment #67
snehi commentedAs suggested by Wim and larowlan, removing if test.
Comment #68
wim leersComment #69
snehi commentedThanks Wim :)
Comment #70
wim leersThank you, @snehi! :)
Comment #71
alexpottI don't understand why the argument here is becoming optional? This seems to have occurred in #35 as a result of mine & @Wim Leers comments in #32, #33, #34 - but I was referring to the new param on accessEditEntityField() not the existing param on access().
@Wim Leers what do you think?
Comment #73
wim leersIndeed, #35 introduced that, without an interdiff, and I failed to spot it. My bad :( You're right of course. Fixed.
Re-reviewed the entire patch now. One question for a core committer:
This needs to become non-optional in the future. How do we communicate that?
Comment #74
alexpottRe #73 the best way would be to do something like this:
And add a legacy test for this. Doing this means that when we come to clean up the @trigger_errors in 9.x.x we'll be reminded to do this. This is only a good idea if we always pass the $account in in HEAD.
Comment #75
wim leers#74… except that this is an interface. So alternative implementations will actually not be made aware.
We should deprecate
\Drupal\quickedit\Access\QuickEditEntityFieldAccessCheckInterface. There is no valid reason to ever override the default implementation, hence there is no valid reason for that interface to exist. You should be able to implement arbitrary access logic via the Entity Access API and/or Field Access API.Once that interface is gone, #74 would work.
In other words: do what #74 says, but also deprecate that interface.
Comment #76
catchAgreed let's deprecate the interface (and also mark it @internal since we're not replacing it?).
Comment #78
wim leersBy now we have much more experience with evolving existing APIs while retaining BC. When #74, #75 and #76 were written that was still kind of treading new ground, not anymore today! So let's get this done :)
Comment #83
neclimdulHaven't really looked at this but ran into it through another issue and rerolled around #3228634: Move tests for integrations between QuickEdit and other modules into QuickEdit so that it can more easily be moved into contrib
Comment #84
neclimdulah, that's an easy fix.
Comment #85
ankithashettyTried to fix custom command failure errors in #84, thanks!
Comment #87
neclimdulYeah, those errors are my fault. Tried a new way of merging patch failures and I messed it up.
Comment #89
spokjeDue to Quickedit being moved out of Drupal Core and into a Contrib Module, moving this issue to the Contrib Module queue.