Deleting moderation state which still have revisions save in that state creates error when trying to display those reivsion

Created on 21 February 2022, almost 3 years ago
Updated 16 September 2024, 3 months ago

Problem/Motivation

When deleting a moderation state there can still be revision that have been saved in that moderation state. If there are revision saved in that moderation state, and the moderation state is deleted, you will get an error when vising the revision log for that entity like this:

InvalidArgumentException: The state 'need_review' does not exist in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase->getState() (line 155 of /code/web/core/modules/workflows/src/Plugin/WorkflowTypeBase.php).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Content moderation 

Last updated 24 days ago

Created by

🇳🇴Norway matsbla

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    Based on #9 and #10 seems like it could still be a problem

  • 🇺🇸United States wweibel

    Issue is still present in 10.1.2

    An approach would be to default to the 'Default State' of the workflow in these instances. Or when deleting a state require the new state be selected and update all the revisions.

    I would prefer the later to avoid stale data being present. Removing the ability to delete states (if there are revisions in that state) is rather heavy handed and virtually guarantees that no state could ever be deleted, and would not reflect changes to human workflow.

  • 🇮🇳India Sahana _N

    Hi

    I tried to reproduce the issue in Drupal 11. x but the issue is not reproducible in Drupal 11. x.

    I attached the screen recording, please review it.

    Please let me know if I made any mistakes.

    Thanks!!

  • 🇨🇦Canada phjou Vancouver 🇨🇦 🇪🇺

    I confirm I have the same issue, I can delete the workflow state, and then the nodes that were using it have a broken revisions list page.

Production build 0.71.5 2024