Problem/Motivation

This recent major task Support pending revisions and accepting translation as a specific moderation state introduced a logic to Review and Save the incoming Job Item / Translation matching as default the Source Translation Status: if it is Published the "Save and Accepted" would Default set the new Translation Moderation State to it, leaving the user able to modify/customise.
This choice is managed by the "#moderation_state" that is set in the job Item data to carry the information about the new moderation state value (see here).

The $data['#moderation_state'] is then used to set the proper moderation state for the Translation (see here).

At the moment, in case of Auto Accepted Job Items, the $data['#moderation_state'] is undefined so as also could be the $data['#published'], thus the Translations are automatically saved matching their original status, causing weird and un-expected outcomes in Basic and more Advanced use case, such for instance the following:
- if the Translation Source is Published but the Auto Accepted is not, then the new Accepted Translation is being save as Un-Published, and setting as Un-Published also the Translation Source, hence breaking the Auto Accept flow of subsequent incoming/remaining Languages Translations

Proposed resolution

In case of Auto Accepted Translation/$data['#moderation_state'] undefined, define it accordingly of the Moderation State of the Source Entity (if Moderated), so to let the Translation publication state being saved accordingly ...

Comments

itamair created an issue. See original summary.

itamair’s picture

Issue summary: View changes
itamair’s picture

Title: Missing logic to match the Source Publication Status in case of Auto Accepted Translations » Broken logic (misisng ($data['#published'])) to match the Source Publication Status in case of Auto Accepted Translations
itamair’s picture

Title: Broken logic (misisng ($data['#published'])) to match the Source Publication Status in case of Auto Accepted Translations » Broken logic (data['#published'] undefined) to match the Source Publication Status in case of Auto Accepted Translations
itamair’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

The attached patch rebuilds the code logic for setting the Auto Accepted Translation Publication status, accordingly to the Source Translation publication status.

itamair’s picture

Title: Broken logic (data['#published'] undefined) to match the Source Publication Status in case of Auto Accepted Translations » Broken logic to set Auto Accepted Translations Publication Status (accordingly to the Source)

Status: Needs review » Needs work

The last submitted patch, 5: tmgmt_autoaccept_publication_logic_3212524_#5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

itamair’s picture

Status: Needs work » Needs review
StatusFileSize
new1.67 KB

This new patches adds also the settings of the source entity moderation state to the Accepted Translation (looks a more solid implementation for matching the required behaviour).

Status: Needs review » Needs work

The last submitted patch, 8: tmgmt_autoaccept_publication_logic_3212524_#8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

itamair’s picture

Status: Needs work » Needs review
StatusFileSize
new995 bytes

A better (and Tests better compliant) patch that just, if undefined, sets the $data['#moderation_state'] for matching the Source Entity Moderation State ...

itamair’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 10: tmgmt_autoaccept_publication_logic_3212524_#10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

itamair’s picture

Status: Needs work » Needs review
marcusml’s picture

Status: Needs review » Closed (works as designed)

I think this behaviour is expected and not a bug. Looking at the discussions at #2978341: Support pending revisions and accepting translation as a specific moderation state you can read that automated workflows were not in the scope of that issue. I tested your patch it is seems to work as intended. But I think the behaviour needs to be configurable. I think there's already work put into this in #3193557: Add setting to set default moderation state. Maybe there's a patch there that you could try?

itamair’s picture

Title: Broken logic to set Auto Accepted Translations Publication Status (accordingly to the Source) » Logic to set Auto Accepted Translations Publication Status (accordingly to the Source)
itamair’s picture

thanks @marcusml ... I quickly checked the last patch in #3193557 and indeed embeds the capability to choose the Source Moderation State as the default one for the Translations being accepted, and it seems working.
I change this in a Feature Request that duplicates and could be accomplished streamlining that task/issue...