Problem/Motivation
I translated two nodes, when I change the state to draft the revision is being created correctly, but when I tried to edit the other translation of the same node, I saw that the translation has the same moderation state even if I haven't edited this translation.
Steps to reproduce it:
1. Create two or more nodes
2. Install content_moderation and workflows
3. Install config_translation, content_translation and locale
4. Add either a custom or default language, in my case I added en-mx and es-mx.
5. Go to language content settings page and check all the content types
6. Go to workflow settings page and apply the default workflow to all the content types
7. Go to content and translate one of the nodes
8. Edit one of the translations, in my case I change the state to draft in the es-mx node.
9. Go to en-mx and you will see the draft state even if this translation was not edited.
Proposed resolution
In order to solve my issue I added a condition to find the correct revision by language, it's working on my end but I would like to know if someone is having the same issue.
Remaining tasks
None.
User interface changes
Fixed states for languages in the translation edit section.
API changes
None.
Data model changes
None.
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#45 | 3020387-45.patch | 908 bytes | ueshiy |
#43 | Moderation_state_same_for_node_translations-3020387-43.patch | 2.51 KB | Ahmad Smhan |
#31 | after.gif | 3.59 MB | jungle |
#31 | before.gif | 4.17 MB | jungle |
#28 | 3020387-27.patch | 2.44 KB | Sam152 |
Comments
Comment #2
luisnicg CreditAttribution: luisnicg as a volunteer commentedComment #3
luisnicg CreditAttribution: luisnicg as a volunteer commentedComment #4
BerdirComment #5
luisnicg CreditAttribution: luisnicg as a volunteer commentedI forgot to mention that I applied this patch #2983958: Users expect the "latest translation affected revision" not the "latest revision" in the views UI when moderating content, It did not solve the issue, but this allows me to review the moderate content.
Comment #6
jazzslider CreditAttribution: jazzslider at Acquia commentedHello! I'm advising a client on how to get independently-moderated translations working, and they've run into what seems to be a bug even with this patch (and https://www.drupal.org/project/drupal/issues/2430335 and https://www.drupal.org/project/drupal/issues/2983958) installed.
Steps to reproduce:
* First off, this is on Drupal 8.6.4.
* Apply the patch in this issue, as well as in the other two linked above.
* Create and publish a node in the site's default language (let's say "English").
* Create and publish a translation of that node in another language (let's say "Spanish").
* Create and publish a translation of that node in yet another language (let's say "French").
* Send the Spanish translation to the "draft" state. At this point the drafts list is correct —it should only include the Spanish translation.
* Send the French translation (the default) to the "draft" state. Drafts list is still correct —it shows both.
* Send the Spanish translation to the "needs review" state. In this situation, _sometimes_ the drafts list shows both (correctly), but occasionally it will only show Spanish, and French disappears.
* Send the English translation (the site's default language) to the "draft" state. At this point the site errors out, and the logs show "Drupal\Core\Entity\EntityStorageException: "The default translation flag cannot be changed (fr)."
It sort of seems like maybe each time a non-default translation is moved into a draft state, the node's default translation flag is changing with it?
Comment #7
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commented@luisnicg nice catch and great instructions to reproduce. I can confirm the issue and also confirm your patch in #3 also fixes this.
Adding a test case for this, if these patches go fail/pass, this looks ready to me.
Comment #8
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #10
luisnicg CreditAttribution: luisnicg as a volunteer commentedThanks for adding the test and an apology for not having added before.
I have been facing many issues working with a multilingual site and content_moderation/workflow. I think there's more to do to get this module ready for multilingual sites.
Comment #12
AMDandy CreditAttribution: AMDandy commentedThe problem in #6 is occurring for us with this patch installed. Is that a by-product of this patch or a completely separate issue?
Comment #13
luisnicg CreditAttribution: luisnicg as a volunteer commented@AMDandy It's a completely separate issue. I was working with Acquia team and #6 is related to the paragraph module.
Comment #14
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commented@AMDandy can you remove the patch and re-test the issue to make sure we haven't introduced a regression with this issue?
Comment #15
AMDandy CreditAttribution: AMDandy commentedWe use paragraphs as well. We've found that it only triggers if a user actually tries to change the default language, though. At least I couldn't get it to trigger by following the steps above or by trying normal content editing/workflow steps.
Comment #17
joseph.olstadPatch #7 still applies, has tests.
I have also encountered this issue when developing content_moderation support for the ETUF module (entity_translation_unified_form).
I have not yet tested this patch, but it looks like it will fix something that I had previously done and replace (code I wrote for) a workaround bypass of the Drupal api in an effort to fix a valid use case for the entity_translation_unified_form module.
In addition, I found that if a translation is added on the creation of a node entity that the moderation state is not added correctly for the translated version and that the only way to fix this through the current drupal api is to add a new revision after saving. a new core issue should be spun off for what I am describing.
With that said, patch #7 seems to be in the right direction and has tests.
Comment #18
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #20
bahuma20I've found a problem when this patch is used...
I have defined a workflow with these states:
We have two roles:
Now to the problem:
An author has created a node in English, and sets it to "needs review".
Now the author wants to add a german translation for this node. He goes to the Translate tab and clicks on the "Add" Button.
The form where he can edit the node and add the german texts is displayed.
Wen he clicks "Save" he 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 created as "draft"?
Is it possible to force the new translation be created as "Draft"?
Comment #21
joseph.olstadI didn't end up using this patch, instead I ended up using the api to acheive a moderation state sync
if you do not want this then try the opposite
Comment #22
bahuma20I've found out that there is a problem with the function ModerationInformation::getOriginalState().
This function should return the initial state of the workflow for new translations.
I've added a patch that adds this functionality.
Comment #23
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedPlease don't report and work on multiple problems in the same issue, it makes it hard for reviewers and committers to know what's what.
Please search the queue or use the "content moderation multilingual bug" to find the bug you've reported and work on two seperate patches.
Reuploading #7 which has a red/green patch already.
Comment #24
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #25
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedFixing IS.
Comment #26
jungleThanks @Sam152!
One nitpick:
Tests that the field ...
Comment #27
larowlanThis looks good to me, the only thing missing is to link to a related issue / follow up that covers #20
Comment #28
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThanks for the review @jungle, didn't realise that was a thing. Updated!
Thanks @larowlan, adding that as a related issue now.
Comment #30
jungleI tried to do manual testing, failed to finish it, even I got myself confused, giving it up 🤦. So just a general RTBC +1 to the patch as the testing passed, and the test-only patch failed as expected.
Comment #31
jungleManually tested, the patch in #28 works as expected. See the attached Gif files. tried with English and Simplified Chinese, (my native language), "草稿" means Draft in English.
Tagging "Bug Smash Initiative"
Comment #34
larowlanCommitted 685f3a0 and pushed to 9.1.x. Thanks!
c/p to 9.0.x
Leaving it RTBC, and moving to 8.9.x for possible backport
Comment #35
joseph.olstadsame patch applies cleanly to 8.9.x , it is already clean for commit.
I suggest pushing this into 8.9.x also as it is a fix and has tests.
Comment #36
joseph.olstadIf you want to make your drupal core maintainer life easier, you could even use cherry-pick instead of wasting time re-patching due to the branch compatibility.
Comment #38
larowlan@joseph.olstad I needed an 8.9 test run before cherry picking. There are changes in tests-classes between 9.1.x/9.0.x and 8.9.x and the last thing I wanted to do is backport an untested patch and break every other RTBC 8.9.x patch because HEAD is failing.
i.e. there is reason in my methodology.
Cherry-picked to 8.9.x.
Nice to see the #bugsmash initiative working together to move through the layers
Comment #39
larowlanComment #40
alexpott@joseph.olstad fwiw for core we do
git cherry-pick -x 685f3a0;
which is what @larowlan did. Git then adds(cherry picked from commit 685f3a060ddaf3c78389fa275a63c7f0e9aa2f21)
to the commit message - which can be helpful to understand the relationship between commit.Comment #41
joseph.olstadMakes sense, thanks!
fwiw could still cherry pick also and still amend the commit lol
anyhow, no worries do as you wish was just trying to suggest something easy lol!
Comment #43
Ahmad Smhan CreditAttribution: Ahmad Smhan commentedThis issue for 8.9.1 version
Comment #44
ahaomar CreditAttribution: ahaomar commentedI have multiple languages (EN,DE,FR) and content moderation is enable. I have two additional status for content moderation one is (Draft, In Review) now problem is currently i have to change the status for each language. in this way quite confusion for content moderator that what left and what done. Could we do something like that content moderation we bring on global level so if its status change for one language same will be implemented for other languages.
If from German language content review status added then for all rest of languages (En, FR) it will be automatically changed the status please guide me in this
is any one guide me do i need to install patch or not?
Comment #45
ueshiy CreditAttribution: ueshiy at Digital Circus commentedThe fix on https://www.drupal.org/project/drupal/issues/3020387#comment-13696688 looks insufficient.
Shouldn't we also consider "revision_translation_affected"?
If anyone can, I would appreciate it if you could re-open this issue.
Comment #46
dww@ueshiy: Please open a new follow-up issue for that and mark it related to this issue. Once a change like this has been committed (and backported), it's very confusing to try to reopen it. Always better to open a new issue and link it. You can comment here with the URL once it exists. Thanks!
Comment #47
emanaton CreditAttribution: emanaton as a volunteer commentedOf 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