Closed (fixed)
Project:
Drupal core
Version:
8.3.x-dev
Component:
content_moderation.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Sep 2016 at 09:31 UTC
Updated:
30 Jan 2017 at 10:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
timmillwoodHere's a test which shows this bug.
Comment #4
timmillwoodThis patch *should* work, but blocked on #2809227: Store revision id in originalRevisionId property to use after revision id is updated.
Comment #6
timmillwoodPostponed on #2809227: Store revision id in originalRevisionId property to use after revision id is updated
Comment #7
timmillwoodNow #2809227: Store revision id in originalRevisionId property to use after revision id is updated has landed in 8.3.x we can fix this!
Comment #9
timmillwoodNeeded a check to make sure that the loaded revision ID is not the same as the revision ID.
Comment #11
timmillwoodComment #12
sam152 commentedUploading a test only patch, because it's a little puzzling why the condition right above it would ever be FALSE while the new one would be TRUE.
edit: figured out above comment after reviewing the patch in more detail.
Based on the condition right above this one I think the whole second part of this condition is superfluous. You only enter this line if getRevisionId is null.
Maybe this method could do with some more commenting.
Rest of the test uses $node->moderation_state->value =, not ->set
nit, should be full form, $previous_revision.
nit, full stop
nit, extra whitespace
Comment #13
sam152 commentedCould this implementation also work?
Comment #15
timmillwood@Sam152 - I quite like your solution, much simpler. I do think the whole getModerationState() method could do with a number of comments to explain how and why it all works because it takes a for moments to understand all the logic in there.
Comment #16
sam152 commentedAgreed. NW based on that.
Comment #17
sam152 commentedAdded some comments and addressed feedback in #12. The extra methods are a bit more self documenting, add some extra comments and reduce the complexity of the big getModerationStateId method.
Comment #18
timmillwoodLittle code exists in #17 from my patch, so guess I am entitled to RTBC.
Looks good, fixes the bug, tidier, easier to understand, all round better.
Comment #19
alexpottLet's not have two additional methods here - I think this is unnecessary. You're always going to want the correct language. I think all we need to do is merge
loadContentModerationRevisionandloadCorrespondingContentModerationStateLanguagetogether and just call itloadContentModerationState.Comment #20
timmillwoodConsolidation of methods as suggested in #19.
Comment #21
alexpottThe early return here is fine but lets capitalise null as per standards.
Let's turn this logic around to avoid the early return. Basically as this logic was before. And then the final line can be
return $content_moderation_state;Comment #22
timmillwoodDone #21.
Comment #23
sam152 commentedinterdiff LGTM
Comment #24
alexpottCommitted 6b34291 and pushed to 8.3.x. Thanks!
Comment #27
timmillwood#2846830: Add changelog for Drupal 8.3.0