When a moderation state is removed from a workflow, existing revisions keep that state stored on them. Diff shows the moderation state next to each revision on the revision overview, and it looks that state up without checking whether it still exists. One such revision is enough to bring down the entire page:

InvalidArgumentException: The state 'ready_for_publication' does not exist in workflow.
in Drupal\workflows\Plugin\WorkflowTypeBase->getState()

The result is a white screen on /node/{nid}/revisions. All revisions of that node become unreachable through the UI, not only the one in the removed state.

Steps to reproduce

1. Install content_moderation and diff.
2. Enable the editorial workflow on a content type.
3. Create a node, publish it, archive it, then publish it again. The Archived state is now only used by an older revision.
4. Delete the Archived state at /admin/config/workflow/workflows/manage/editorial. Core allows this, because no current content uses it.
5. Visit /node/{nid}/revisions.

Expected: the revision overview loads.
Actual: white screen, with the exception above.

Issue fork diff-3617616

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

esthertempel created an issue. See original summary.

esthertempel’s picture

A patch that worked for our Drupal 11 site is attached

acbramley’s picture

Thanks for the report and contribution, however patches are no longer accepted. Work will need to be done in an MR for review. We will also want some tests.

acbramley’s picture

Status: Active » Needs review
acbramley’s picture

Status: Needs review » Fixed

Fixed, the test can't be enabled without the core fix.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • acbramley committed 48e4a8b7 on 2.x
    fix: #3617616 Revision overview fatals when a revision's moderation...