Problem/Motivation

This is a conflict with #2856363: Path alias changes for draft revisions immediately leak into live site. The validator checks for defaultness which isn't set by the time the validator kicks in.

Reproduce:

  1. Edit a pending revision.
  2. Update the URL alias and click on a "published / default" state.
  3. See error where there should be none.

Proposed resolution

I think this will be fixed by taking the same approach as #2883868: Content Moderation decides to set a new revision as the default one way too late in the entity update process.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Sam152 created an issue. See original summary.

Sam152’s picture

Issue summary: View changes
Sam152’s picture

Title: Path aliases cannot be updated after update to 8.4.0. » Path aliases cannot be updated after update to 8.4.0 when creating a new published revision.
Sam152’s picture

The crux of the problem is, we need all of the default/publishing etc to take place at the API level when setting the moderation_state field for entity validations to work. We could update this in the field widget, so it would work at the form level, but $entity->validate() would still be incorrect if you set the moderation_state field manually.

A custom list class would solve this, like we have with the computed field, we could then move most of EntityOperations::entityPresave to onChange in the list class.

This is quite a significant change however and it would essentially mean calling off to an entity handler method onPresave not actually during a presave, but any time the moderation_state field is changed.

The other option would be to stop delegating the responsibility of updating the default revision to the entity handler and essentially call isDefaultRevision/setNewRevision twice.