Can't save some nodes after updating to 8.x-1.4

Created on 19 July 2022, about 2 years ago
Updated 11 August 2024, about 2 months ago

Problem/Motivation

After updating from 8.x-1.3 to 8.x-1.4 some existing nodes can't be updated. The error message is saying "The value you selected is not a valid choice."
I figured out it relates to the values set on `publish_state` and `unpublish_state` fields. The nodes that can't be saved have the value '_none', other nodes that CAN be saved have other values but usually don't have it (null).

The problem occurs for nodes of any content types - for those that are under content moderation workflow and for those that are not.

Steps to reproduce

I don't know exact steps to get to this state.

1. Have a content types to which moderation workflow is not applied
2. Create a node of the content type
3. Set it's publish_state and unpublish_state field values to `_none` - not sure how exactly
4. Open the node edit form and submit it
5. The error message saying "The value you selected is not a valid choice." appears.

Proposed resolution

It seems that the problems lies in the allowed values callback `_scheduler_content_moderation_integration_states_values` that is returning an empty array. The existing `_none` value doesn't pass the validation against an empty array.

If the issue relates to upgrade then probably 8.x-1.4+ should provide an upgrade path removing `_none` values.

Extending the default set of options generated by `_scheduler_content_moderation_integration_states_values` to `['_none' => '_none']` (or something similar) will let you save such nodes. I don't understand the consequences though.

I'd appreciate any advice on the subject.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
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 Kingdom jonathan1055

    The issue relates to updating from 8.x-1.3 to 1.4 so I don't think asking for testing at 2.x will show up anything. I recall that there were some changes to the state dropdowns between 1.3 and 1.4 so maybe we do need a hook_update to fix any old data which is now not valid.

    Needs more investigation.

  • πŸ‡ΊπŸ‡ΈUnited States pcate

    @cgmonroe's description seems like the same issue a client just encountered. Was running 8.x.1.4. Tried 2.x but it had the same issue. Downgrading to 8.x.1.3 resolved the issue.

  • @smustgrave opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Okay FINALLY was able to recreate

    Add workflow to Article content type
    Turn on scheduler
    Remove draft to published transition
    Remove article from workflow

    Now try and create an Article
    Will see the scheduler (as expected)
    Won't see publish_state (as expeded)
    But clicking save triggers the error.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So fixed this by adding some code that when the workflow is saved it should recheck the forms and update.

  • πŸ‡­πŸ‡ΊHungary segi

    I found that the #3135341 issue introduced the problem in 1.4.
    There is a quick fix until this won't be fixed. Probably the default option was removed with good reason.

  • Status changed to Needs work over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    @smustgrave in #10 your Steps to Reproduce may have found a problem, that we need to update the form displays when the workflow is edited, but I think that is separate from this issue. This issue is all about the change from 8.x-1.3 to 1.4 when the '_none' option was removed. I will raise a new issue for the problem you have found, and we can work on that separately.

  • Status changed to Postponed: needs info 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since we don't have 8.x-1.x marked supported can we confirm this is an issue in 2.x and/or 3.0.x?

  • Status changed to Closed: outdated about 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    If still an issue on 2.0.x or more importantly 3.0.x please reopen.

Production build 0.71.5 2024