New translations for moderated nodes are not created in the initial workflow state

Created on 9 June 2020, over 4 years ago
Updated 13 February 2024, 9 months ago

Problem/Motivation

We have defined a workflow with these states:

  1. Draft
  2. Needs Review
  3. Published

We have two roles:

  • author (Who creates content in draft and sets it to "needs review")
  • admin (Who can transition from "needs review" to "published")

Steps to reproduce

  1. Enable the Content moderation and Content translations modules, and their requirements.
  2. Add another language to the site.
  3. Enable translation for Content (nodes) for at least one content type.
  4. Enable the Editorial workflow for at least one translatable content type.
  5. Configure the workflow with the 3 states listed above (draft, needs review, published), and 4 transitions:
    1. draft -> draft
    2. draft -> needs review
    3. needs review -> draft
    4. needs review -> published
  6. Configure 2 roles:
    • author (with permission to use draft -> draft and draft -> needs review transitions)
    • editor (with permission to use all of the above workflow transitions)
  7. An author has created a node in English, and sets it to "needs review".
  8. Now the author wants to add a translation for this node. They go to the Translate tab and click on the "Add" Button.
  9. The form where they can edit the node and add the german texts is displayed.
  10. When they click "Save", they gets the error message "Invalid state transition from Needs review to Needs review".

Logically that is correct, because the author role doesn't have the permission to edit nodes which are in the state "needs review".

But shouldn't new translations be treated as new nodes and therefore be created as "draft"?

Proposed resolution

Preserve the existing behavior for BC, but add a way to configure this when defining a workflow.

Whatever new UI is introduced should only be visible if both Content moderation and Content translation modules are enabled.

Option B

(Other rejected proposals removed, this is what we're going with).

  • Have a simple toggle for the current behavior vs using the default moderation state (same as A)
  • UI is 2 radios.
  • Setting stores a string, ID would be 'translation_default_moderation_state_behavior' or so, with values like 'current' vs. 'default'.
  • In some UIs, explicit radios for different options can be more clear than a checkbox (if each choice requires a little explanation).

Example UI:

Initial moderation state when adding a new translation:
(*) Default moderation state
( ) Current moderation state of the original content

Open questions

  1. Option B - radio buttons. See #45
  2. Yes (@larowlan in #42)
  3. YES
    1. ? YES
    2. Using 'current' per @larowlan in #42
    3. YES
  4. YES: https://www.drupal.org/node/3240957 β†’
  5. YES:
    1. YES (per @larowlan in #44). DONE in patch #47
    2. YES (per @larowlan in #42). DONE in patch #47
  6. NO, leave it as 'current' (per @larowlan in #42).
    1. Use hook_entity_translation_create() YES.
    2. NO
  7. See #101.

Remaining tasks

    1. Done in #47
    2. Done in #47.
  • UX team proposed a solution in #101, implemented in #104
  • RTBC

User interface changes

A new setting when creating/editing a workflow:

Before

What you see without the patch applied, or when content_moderation is enabled but content_translation is not, at paths like /admin/config/workflow/workflows/manage/editorial:

After

With the patch applied, and both content_moderation and content_translation enabled:

Initial moderation state when translating existing content*
(*) Default moderation state
( ) Published if existing content is published, otherwise Draft

API changes

None.

Data model changes

New config schema for a setting on workflow type plugins.

Release notes snippet

TBD.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Content moderationΒ  β†’

Last updated 1 day ago

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

πŸ‡©πŸ‡ͺGermany bahuma20 Germany

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