Closed (fixed)
Project:
Drupal core
Version:
9.4.x-dev
Component:
jsonapi.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Feb 2019 at 09:18 UTC
Updated:
6 Oct 2023 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersAll correct! Unfortunate, isn't it? 😔
It seems like you're just stating facts in this issue. So … what were you hoping to achieve with this? To have an issue to follow so you know when generic support is added? If so: 👍🙏
If not: please clarify :)
Comment #3
Roensby commentedJust so - I was afraid that the lack of generic entity support would be forgotten, since it was only mentioned in https://www.drupal.org/comment/12818386, and there doesn't appear to be an issue specifically for this.
Sorry for the ambiguity - and thanks for the work! I would love to help on this issue, but have trouble seeing a way forward.
Comment #4
wim leersDon't apologize — we should've created this issue ourselves instead of only pointing to a core issue. There already is pretty strong demand for this feature in core thanks to the Workflow Initiative. But it sure helps to have this issue to gauge interest!
So thank you! 🙏
Comment #5
wim leersClarifying issue title.
Comment #6
wim leersPer #2795279-66: [PP-2] [META] Revisions support, this is not blocked on #2350939: Implement a generic revision UI anymore, but on #3043321: Use generic access API for node and media revision UI, which captures only the relevant subset of #2350939.
Comment #8
pq commentedI think it might be worth temporarily updating the change record (https://www.drupal.org/node/3015434) to articulate that this is the case. Not just that only node and media entities are supported but also that if loading node entities with included references to revisioned entities (e.g. entity_reference_revisions / paragraphs), those included entities will always be the most recent version.
It also seems a little regrettable that there is simply no way (at least that I could find) of getting around this without hacking core.
Comment #10
lois.chabrand commented@PQ did you find a solution, even if you hack the core ?
Comment #11
pq commentedHi @lois.chabrand. I did end up patching core for our requirements. I've attached the patch file if it helps you out. It only adds support for paragraphs included as part of a node but hopefully if you're not using those then it might serve as a pointer for other entity types.
Comment #12
lois.chabrand commentedHi @PQ,
thanks for your patch, it seems to work for paragraph included in Node, unfortunately we have an other issue with nested paragraph included in Node.
Comment #13
lois.chabrand commentedComment #14
lukusHi .. thx for work on this, wondering what the status of this is now?
Comment #17
wim leers#3043321: Use generic access API for node and media revision UI landed! 😊 Time to re-evaluate this.
Comment #18
damienmckenna@PQ: to make it work as you're hoping for with Paragraph entities does it also need this change?
Comment #19
pq commentedHi @DamienMcKenna,
I don't really recall why that line was there, it may have been to prevent other entities from having negative effects from the changes.
That said, my patch was fairly bespoke to the requirement of just getting it working for paragraphs so I don't know if it will be a good starting point for more generic entity handling. I'll be delighted if it does help in that endeavour in any way though :)
Comment #20
mstrelan commentedUpdated the issue summary to reflect the current status.
Comment #21
mstrelan commentedComment #23
larowlanComment #24
mstrelan commentedThat's all from me for today. I believe the remaining fails are due to \Drupal\Tests\jsonapi\Functional\ResourceTestBase::testRevisions trying to test content_moderation on unmoderatable entity types (MenuLinkContent, PathAlias, Term).
Comment #25
mstrelan commentedComment #26
bbralaI started review on this and got pretty far, but have ended up out of time unfortunately.
Code looking good. I was just thinking if there is any tests left that don't test revisions.
Also your comment on
core/modules/jsonapi/tests/src/Functional/TermTest.phpdid trigger me, is there an issue for that somewhere on the queue or do we need a child issue for that?I hope i can resume this sometime soon, but if someone else wants to dive in, please don't hessitate to do so.
Comment #27
mstrelan commentedI couldn't find one, we should create one as a blocker for #2936995: Add taxonomy term revision UI.
Comment #28
bbralaThat sounds like it is a good idea (tm) :)
Comment #29
bbralaOne thing that kinda worries me when looking at this that the changes to the tests mean those are only tested while revisionable. Wouldn't it make sense to keep the old unrevisioned tests, but perhaps extend the tests to run once while revisionable and once without?
I think changing all the existing tests like this would probably get called back by committers to be honest. So rather introduce something like
BlockContentRevisionableTestI think.Comment #30
bbralaJust saw this issue #3225953: Add generic entity-type test coverage for JSON:API and revisions which seems related.
Comment #31
acbramley commentedPatch for composer workflows.
Comment #32
bbralaOk, I went through this issue again. Tried to have a go at the separation, but it doesn't make too much sense to separate. Since these types are revisionable they should be treated as such. Setting RTBC.
We do need a changerecord, so i created one.
Comment #34
larowlanRandom layout builder fail
Comment #35
larowlanCan we get another MR against 10.0.x for this?
Thanks
Adding tag Needs reroll, but only for a 10.0.x MR.
Comment #36
larowlanLeft a comment on the MR
Comment #38
drs2034 commentedUpdate to #13 patch to work with Drupal 9.3.7
Comment #39
bbralaI've created the follow-up issue #3269029: Accesscheck for Terms doesn't support the new 'view all revisions' permission. Considering this back to RTBC, we can fix the taxonomy access later.
Comment #40
bbralaComment #41
larowlanI don't see any taxonomy changes in #2350939: Implement a generic revision UI so I'm not sure what the approach would be for #3269029: Accesscheck for Terms doesn't support the new 'view all revisions' permission.
Looking at TermAccessControlHandler, its not clear what we'd do.
I suspect rather than defer to either 'administer taxonomy' we'd probably need to add new permissions.
The basis that we need a discussion on how to handle this is one reason not to hold up this issue. But it begs the question, is this patch even useful at all for terms if you need to grant the 'administer taxonomy' permission? I don't think it is. I understand that it also makes it available for media, block_content and a myriad of entity-types in the contrib space. So perhaps that's another vote not to hold it up. I'll raise it on the next committers meeting.
Comment #42
bbralaYeah I would argue that this is quite useful even if terms are not supported.
Comment #43
kristen polFor anyone using 9.2, here's a reroll of the MR that's working for us on 9.2.11.
Comment #44
larowlanI discussed this with other committers at a recent core-committers meeting.
The consensus was (to quote webchick)
I've rebased both the 9.4.x and 10.0.x MRs via the gitlab UI.
I'll let the tests run on both branches and revisit this in the morning.
Comment #45
bbralaNice, thanks @larowlan
Comment #48
larowlanThanks folks, this is in.
I'll publish the change record.
See you in the followups
Comment #50
mykola dolynskyihttps://www.drupal.org/project/drupal/issues/3031271#comment-13706800
@lois.chabrand , @PQ - thank you very much, with small changes that works good to drupal 9.5.2
Comment #51
mykola dolynskyiupdate to https://www.drupal.org/project/drupal/issues/3031271#comment-14884943 - it was working good, until we deleted some nodes which share the paragraph
afterthat we getting
Error: Call to a member function getEntityType() on null in Drupal\jsonapi\Access\EntityAccessChecker>checkRevisionViewAccess() (line 249 of web/core/modules/jsonapi/src/Access/EntityAccessChecker.php)Comment #52
mykola dolynskyiadding patch which overcomes https://www.drupal.org/project/drupal/issues/3031271#comment-15257741
It basically ignores parent part of access check if parent is null