Content moderation workflow changes against one language affect translations too

Created on 18 January 2019, almost 6 years ago
Updated 7 May 2024, 8 months ago

Problem/Motivation

Steps to reproduce from #3117751: Unpublished revisions of multilingual node rollback unpublished revision of another language to default revision :

Let's have a multilingual site & node with more than 1 language (i.e. node is translatable): EN & DE.
Also enable Workflows module to have draft & published states.

We have 2 published revisions for EN & DE languages.
Then we create new revision of node with EN language but do not publish. Database containt up-to-date value for e.g. field body.
After it we create new draft revision of DE node.
Database contains value for body field for EN node from previous published (default) revision.
Drafts with different languages of one node should not revert another draft to previous state.
It also affects JSON:API.
There are a lot of possible related issues I guess:
#2875861: Optimize updating data and revision data tables
#3023194: [PP-2] Add parallel revisioning support
#2795279: [PP-2] [META] Revisions support
📌 $entity->original doesn't adequately address intentions when saving a revision Needs work
#2833049: ContentEntityBase::hasTranslationChanges will compare a forward revision with the default one instead of the newest forward revision
📌 Codify mechanism to set a forward revision as the default revision Closed: outdated
#2960887: Do not create field revisions when field data hasn't changed
#2769741: Node revisions page might not list a default revision
🐛 Cannot add new translation if the latest affected translation revision of the source language is older than the default revision Needs work
🐛 EntityRepository::getActive does not return a translations most recent revision Needs work
#2815949: It is not possible to know if a revision was once the default
#2766957-176: Forward revisions + translation UI can result in forked draft revisions - potential root cause
🐛 User can't reference unpublished content even when they have access to it Needs work

How to reproduce

  • 1. Add 2 languages to site (EN and any one).
  • 2. Make "Article" node revisionable & translatable.
  • 3. Create Moderation Workflow with: draft, review, published states.
  • 4. Create Published revision of node with default language: body field text = "published default"
  • 5. Create Draft revision of node with default language: body field text = "draft default"
  • 6. Verify database table "node_revision__body", created node has body_value = "draft default" for default (en) language
  • 7. Create Published revision of node with non-default language: body field text = "published translation"
  • 8. Create Draft revision of node with non-default language: body field text = "draft default"
  • 9. Verify database table "node_revision__body", created node has body_value = "published default for default (en) language

Visually database will look like:

Revision 9659 contains new EN content but reverts RU to previous published.
Revision 9660 contains new RU content but reverts EN to previous published.
Revision 9661 contains new EN content but reverts RU to previous published once again.

Original report: I am using Content moderation, Workflows, Language and Content translation core modules in Drupal 8.6.4. I have implemented workflow on Basic page with states like (Draft, Audit, Review, Pre Publish and Publish). Now I am creating a Test content in English as well as in Spanish language and pass all the workflow states and publish the content in both language. Now when i try to update the moderation state of both of these content to Draft one of them gets auto published, but inside the edit mode it shows current state as Draft only for both of the content which is correct. (Here, we are refering to content_moderation_state_revision table in DB)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Content moderation 

Last updated 17 days ago

Created by

🇮🇳India Nitish k

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 States emanaton

    Of possible interest, we solved this issue on our suite of sites by applying the patch found at: https://www.drupal.org/project/drupal/issues/2845144#comment-14574850 🐛 User can't reference unpublished content even when they have access to it Needs work

  • Regarding #19 🐛 Content moderation workflow changes against one language affect translations too Needs work

    We are also experiencing an issue at random, I believe it is what you are referring to. Moving translated content through content moderation workflow sets the current published default language material to not published seemingly at random. This is obvious on our site as there is a contextual filter set to create anchor links to paragraphs on each node. Occasionally a node will have its default status set to unpublished because multilingual content is being moved through workflow. Still trying to determine exactly what set of parameters triggers this.

  • Status changed to Active 12 months ago
  • 🇺🇸United States dww

    There's no code started here, so this is more accurately "active" not "needs work". All issues should target version 11.x for now, and will be backported to the right branch(es) as needed by the core committers.

    Sounds like this is still an issue, although based on #21 this might be duplicate with 🐛 User can't reference unpublished content even when they have access to it Needs work ? Adding to the pile of related issues.

    Regardless, tagging to be smashed...

  • 🇦🇺Australia pameeela

    We are a bit puzzled by the suggestion that this is a duplicate of 🐛 User can't reference unpublished content even when they have access to it Needs work as it does not seem related at all. Just in case, we tried the patch from there and it did not resolve our issue.

  • Yes I do think this is a critical issue, still active. Last and current project still have same exact problem.

    I wanted to post again to try to be more succint and to describe it from the content manager's perspective.

    Assume you have two languages, EN and ES, you have workflows, moderation states, translatable entities, etc:

    1. Save a draft of a node in EN.
    2. Save a draft of the same node in ES.
    3. Publish the ES draft.
    4. Content manager no longer has access to edit the EN draft in step 1, because it is no longer the "latest revision". They can still see this draft in the revision history but it's not editable. They essentially lose all their work.

    Hope this helps.

  • 🇦🇺Australia pameeela

    @mdranove I see, thanks, that does sound like it relates to 🐛 User can't reference unpublished content even when they have access to it Needs work but I think that's not the same as the issue here.

    Our issue is simply with the publish status of translations being updated. If you have a node with two translations, updating the publish status of one translation has unexpected effects on the other.

    There are a few ways that this plays out, depending on whether publish status is translatable, but it doesn't relate at all to editors being able to access the content or not.

  • I am also facing this issue with D 10.2.4. Can anyone help us to fix this problem.

    Steps to reproduce the issue:
    1. Multi-lingual site with Custom Languages , enabled Workflows module to have draft, published & Unpublished states.
    2. Create English content as published.
    3. Translated English content to Portuguese and Published.
    4. Trasnlated English content to French and Published.
    5. Made some changes to Portuguese content saved as Draft.
    6. Made some changes to French content saved as Draft. Portuguese Draft content changes are not showing now, showing published content.

  • 🇺🇸United States charginghawk

    If anybody else is banging their head against this issue, here was my quick fix, assuming that you only want unidirectional updates from English to other languages:

    /**
     * Implements hook_ENTITY_presave().
     *
     * @param \Drupal\Core\Entity\EntityInterface $entity
     *
     * @throws \Exception
     */
    function my_module_node_presave(EntityInterface $entity) {
      // Don't let non-english content disrupt any other languages.
      $active_langcode = $entity->language()->getId();
      if ($entity instanceof NodeInterface
        && $entity->isTranslatable()
        && !$entity->isNew()
        && ($active_langcode !== 'en')
      ) {
        $translations = $entity->getTranslationLanguages();
        foreach ($translations as $translation_langcode => $translation_language) {
          if ($translation_langcode !== $active_langcode) {
            $translation = $entity->getTranslation($translation_language->getId());
            $translation->setRevisionTranslationAffected(FALSE);
          }
        }
      }
    }
    
Production build 0.71.5 2024