Closed (fixed)
Project:
Drupal core
Version:
8.3.x-dev
Component:
content_moderation.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Oct 2016 at 09:08 UTC
Updated:
27 Mar 2017 at 10:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sam152 commentedI can't seem to find any docs on the difference between extra and join_extra. The latter seems far less common in core and I can't actually see where join_extra actually impacts a query, outside one mention in reverse relationships.
Perhaps someone more familiar with views could validate this?
In any case current patch fixes my issue.
Comment #3
sam152 commentedComment #5
sam152 commentedThe test coverage existing leads me to believe there is something more complex going on in my use case than a simple mixup in keys.
Comment #6
sam152 commentedI'm not confident #2 is in the right direction. Here is a failing and passing test with the entity type contained in #2812811: Use EntityPublishedInterface during moderation of entities to add support beyond nodes. There is an interdiff between the patches which should show that creating an unrelated entity fails the tests and none of the other test boilerplate interferers.
Comment #8
timmillwoodIn #2787881: Moderating a non-translatable entity type throws exception we are just editing the EntityTestWithBundle entity type to make it revisionable, which saves having to create a new entity type (and bundle).
Comment #9
dawehnerI'm super confused that https://www.drupal.org/files/issues/2819477-views-integration--passing-t... fixes the problem, given that it doens't really contain a fix?
Nice!
Is this leftover code we can remove?
Comment #10
sam152 commentedBoth are the failing patch, just one has the inderdiff applied to demonstrate the specific part of the patch that was causing the fail. I haven't developed a patch that fixes all the test cases including the one contained in #6.
Comment #11
sam152 commentedTest based on approach found in #2787881: Moderating a non-translatable entity type throws exception.
Comment #13
timmillwoodI guess this shouldn't be commented out.
Comment #14
sam152 commentedGood point, this should produce 2 fails.
Comment #15
sam152 commentedI think the fails are issues with the test views more than anything else. They pass with the all of the current join conditions commented out.
Not sure how to proceed from here.
Comment #18
sam152 commentedDecided to revisit this one and believe I've cracked it. There is a join based on revision IDs in one of the definitions, but in this case two base tables are being joined, which only ever have a single row for each entity. From what I can see this makes sense, but I'm also somewhat relying on the test coverage to guide this change, as it's still quite a complex part of the module.
Requires code from #2812811: Use EntityPublishedInterface during moderation of entities to add support beyond nodes, will set to needs review after that is in.
Comment #19
sam152 commentedFound a bug in the tests, it was checking the node in the test against the revision ids for the ContentModerationState entity instead of the node entity. Fixed here.
If this passes, I think it's worth another review.
Comment #21
sam152 commentedComment #24
dawehnerAh that makes sense, thank you for the explanation.
Comment #25
timmillwood#2845151: ContentModerationStateFormatter pretends it's for the moderated entity, but it is for the content moderation state entity is also working to resolve Views issues.
Comment #27
jibranLooks good to me.
Comment #28
sam152 commentedI wonder if this should be ported to workbench_moderation too?
Comment #29
xjmSo like. The view will show totally wrong data? That's a neat "feature". ;) Sounds major to me.
I don't know that this is actually enough to ensure that the node and the test entity have the same serial ID. Sometimes serial IDs in tests are different from what one expects. At the least, I think we should add an assertion that the two entities' IDs are the same, but there might be some other trick in some test somewhere for ensuring they have the serial IDs we expect. (Yes that's very helpful and specific, I know.)
Comment #30
xjmTechnically this fix could disrupt a site relying on the "feature" that the view shows them additional rows, but since Content Moderation is also alpha, I think this can go into any patch release or the beta.
Comment #31
jibranGreat! idea @xjm. result rows will have all the entities so we can add asserts on that.
I found another point.
This is a views data change so we at least need an update hook to clear the cache. A post-update hook will do ;-)
Comment #32
sam152 commentedUpdated to assert the IDs are the same. Setting the ID of the test entity also works, so may as well ensure it matches the node.
The module is experimental and doesn't need an upgrade path.
Comment #33
sam152 commentedRe: #30, having come across this in a real world scenario, my reaction was "eek, why do my views keep going nuts" more than "what a neat feature" ;-)
Comment #35
sam152 commentedComment #36
sam152 commentedComment #37
sam152 commentedThis was so close. Any other takers on a review? :)
Comment #38
benjy commentedWould be good to have this in.
Comment #39
alexpottCommitted and pushed d66623e to 8.4.x and c109192 to 8.3.x. Thanks!
unused use fix on commit.