Problem/Motivation
In a non-live workspace context Drupal\content_moderation\ModerationInformation::getDefaultRevisionId always returns the latest revision id, even if it's a pending revision. Even if we accept the way in which Workspaces and Content Moderation work together right now, i.e. that
$entity = \Drupal::entityTypeManager()->getStorage($entityTypeId)->load($entityId);
returns pending revisions, there should be a method to get the id of a default revision. At the moment this requires a direct database query.
Proposed resolution
Make Drupal\content_moderation\ModerationInformation::getDefaultRevisionId return the id of the most recent default revision that is available in the current workspace.
Remaining tasks
We should have a test suite that defines all the possible ways in which workspaces and content_moderation can be used together and getDefaultRevisionId should be covered there. Writing the foundation for that suite is beyond the scope of this issue.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
The getDefaultRevisionId method of the content_moderation.moderation_information service now works as expected in non-live workspaces.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3081092-4.patch | 3 KB | blazey |
Comments
Comment #2
blazey commentedComment #3
blazey commentedComment #4
blazey commentedComment #5
blazey commentedComment #6
blazey commentedComment #7
blazey commentedComment #8
blazey commentedComment #9
sam152 commentedI suspect based on the outcomes of the discussion in #3037136: Make Workspaces and Content Moderation work together, that this is actually by design, but I can ask @amateescu to confirm this before closing.
Comment #10
amateescu commentedYup, this is by design based on comment #19 from #3037136-19: Make Workspaces and Content Moderation work together.
Comment #11
sam152 commentedGreat, thanks for confirming that.