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.

CommentFileSizeAuthor
#4 3081092-4.patch3 KBblazey

Comments

blazey created an issue. See original summary.

blazey’s picture

Title: ModerationInformation::getDefaultRevisionId returns the latest revision in workspace context » ModerationInformation::getDefaultRevisionId returns the latest revision when called in a workspace context
blazey’s picture

Issue summary: View changes
blazey’s picture

Assigned: blazey » Unassigned
Status: Active » Needs review
StatusFileSize
new3 KB
blazey’s picture

Issue summary: View changes
blazey’s picture

Issue summary: View changes
blazey’s picture

Title: ModerationInformation::getDefaultRevisionId returns the latest revision when called in a workspace context » ModerationInformation::getDefaultRevisionId returns pending revision when called in a workspace context
blazey’s picture

Issue summary: View changes
sam152’s picture

Assigned: Unassigned » amateescu

I 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.

amateescu’s picture

Status: Needs review » Closed (works as designed)

Yup, this is by design based on comment #19 from #3037136-19: Make Workspaces and Content Moderation work together.

sam152’s picture

Great, thanks for confirming that.