Inconsistency between UI-created and code-created revision

Created on 16 September 2020, over 4 years ago
Updated 14 July 2023, over 1 year ago

Problem/Motivation

In some cases there seems to be some inconsistency on the node_field_revision.revision_translation_affected value, when a revision is created by the UI or by code.
The first case (UI) gives value 1, while the second (code) gives NULL.

As a result, when visiting the node/NID/revisions page, on the first case (UI) one can see the new revision, while on the second case (code) the revision is missing.

Steps to reproduce

  • Enable code moderation for a node type.
  • Edit a transition (or create a new one) that allows transition from Draft to Archived.
  • Create a node A by the UI and save it as Draft.
  • Edit the node and change the state to Archived (no Published state in between).
  • Go to node/NID-A/revisions.
  • You will see both revisions.
  • Now create a custom drush command, or anyway execute somehow a proper code like this on a Drupal context:
        $node = Node::create([ 
          ...
        ]);
        $node->save(); // This will create the initial draft for the node B
        $node->set('moderation_state', 'archived');
        $node->save(); // This will create new revision with Archived state for node B
    
  • Go to node/NID-B/revisions.
  • The second revision is not there.

If you now take a look at your database's table node_field_revision on the revision_translation_affected column, you will see that the node-A's 2nd revision has value 1, but the node-B's 2nd revision has value NULL.

Proposed resolution

The 2 ways of creating the new revision should be consistent. More debugging needed to find out the cause.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: outdated

Version

9.5

Component
Content moderationΒ  β†’

Last updated 24 days ago

  • Maintained by
  • πŸ‡¦πŸ‡ΊAustralia @Sam152
Created by

πŸ‡³πŸ‡΄Norway efpapado

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.

Production build 0.71.5 2024