Problem/Motivation

  1. Configure a site with two languages
  2. Enable content translation and content moderation for nodes
  3. Create a node in language-1 with the "published" state
  4. Translate to language-2
  5. The current state will be shown as "published", which seems odd because the translation has not been added.

This was discovered in #2915398: The moderation_state field is not computed during the creation of a new entity translation..

Proposed resolution

Use hook_entity_translation_create() to reset the moderation state.

Remaining tasks

Fix tests

User interface changes

API changes

Data model changes

Comments

timmillwood created an issue. See original summary.

timmillwood’s picture

Title: When adding a new translation the entity is not correctly prepared » When adding a new translation the entity should start from the draft state
Component: content_translation.module » content_moderation.module
Issue summary: View changes
Status: Active » Needs review
Issue tags: +Workflow Initiative, +Needs tests
StatusFileSize
new1.99 KB

This is a little change in direction for this issue to provide a content_moderation specific fix.

Status: Needs review » Needs work

The last submitted patch, 2: 2927455-2.patch, failed testing. View results

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

sam152’s picture

Category: Bug report » Feature request

I wonder if changing this now would be a significant enough change in behaviour that this should be considered a feature request and be made configurable?

kennethos’s picture

StatusFileSize
new2.96 KB

There's a validation issue when using patch #2. The validate function in "ModerationStateConstraintValidator.php" checks if the original state can transition to the new state. When adding a new translation, the original state should be "draft" instead of the state of the source translation.

jens.de.geit’s picture

Version: 8.6.x-dev » 8.8.x-dev
Category: Feature request » Bug report

First the patch #7 is not working on 8.8.x we should look for a re-roll.

Secondly this issue isn't a feature request but a bug in the content_moderation module. The state of the translation should never be shared with the original node object because a translation needs the same flow to get validated as the original node.

jens.de.geit’s picture

StatusFileSize
new2.73 KB

reroll of patch #7 for core 8.8.x

sam152’s picture

Secondly this issue isn't a feature request but a bug in the content_moderation module. The state of the translation should never be shared with the original node object because a translation needs the same flow to get validated as the original node.

What about the existing users of the module who are already using a translation workflow which depends on starting from the state of the original translation?

bahuma20’s picture

Status: Needs work » Closed (duplicate)

This is a duplicate of #3150294: New translations for moderated nodes are not created in the initial workflow state.
The solution in this 3150294 is better than the one in this issue, because it doesn't add the functionality in a hook but directly where the problem is.

If you see this different, feel free to open the issue again.

brenk28’s picture

For what it's worth, trying to solve the issue in #3069674: Translated node disappears (from backend UI and public site) (which is seemingly related to this), the above 2927455-8.patch fixes the issue for us, though 3150294-5.patch in #3150294: New translations for moderated nodes are not created in the initial workflow state did not.