Problem/Motivation
Hi guys,
I found a bug when we enable Content Moderation and content translation modules.
I tried to create a content and translate it in different languages in publish state first.
After adding some translations in different languages via the translation form of Drupal, I decided to add a new draft version to one of my translation.
When I add a new published translation, some of my previous translation disappeared in the node translation dashboard (node/{nid}/translation). In the database, I can see all my previous revisions but not in the UI.
Steps to reproduce:
- Create a publish content in EN (for example)
- Translate this content in DE language and publish it.
- Translate this content in IT language and publish it.
- Create a new draft version for IT version
- Add a new ES translation
Proposed resolution
The entity load in the ContentTranslationController is not the right one. Instead of using `getLatestTranslationAffectedRevisionId` to get the correct revision, use the `getActive` method from the Entity Repository.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | interdiff_3250594_16-18.txt | 1.71 KB | _pratik_ |
| #18 | 3250594-18.patch | 4.83 KB | _pratik_ |
| #16 | interdiff-15_16.txt | 968 bytes | gauravvvv |
| #16 | 3250594-16.patch | 3.85 KB | gauravvvv |
| #15 | core-translate_moderated_content_get_active-9.5.x-3250594-15.patch | 3.69 KB | johnrosswvsu |
Comments
Comment #2
JnLuC21 commentedComment #3
JnLuC21 commentedComment #4
JnLuC21 commentedComment #5
JnLuC21 commentedComment #6
JnLuC21 commentedComment #7
Heisen-blueComment #8
supriyaguptaI have tried this with Drupal version 9.2.x . I have installed workflow module and configure translation module but nothing is working fine on node form workflow state not displayed.
Comment #9
JnLuC21 commentedHi @supriyagupta,
My patch is only functional in Drupal 8.9.
I will post an patch for Drupal9 ASAP.
Comment #12
rajandro commentedComment #15
johnrosswvsu commentedAdding a patch applicable for 9.5.x.
Comment #16
gauravvvv commentedAdded missing parameter comment. Attached interdiff for same. please review
Comment #17
smustgrave commentedWonder if this could be related at all #2806009: Installing a module causes translations to be overwritten
If separate this will need tests to show the issue.
Comment #18
_pratik_Comment #19
smustgrave commentedStill needs an answer for #17. Not ready for review.
Comment #20
dabblela commentedIt looks like this is the same issue as #3329066: Creating a new translation may delete translations with drafts. That issue also has a patch with tests, but a different fix. I'm not really sure what the best approach is, I think the patch there is a little closer to how translation currently works.
I don't believe #2806009: Installing a module causes translations to be overwritten is related, that looks more like interface translation than content translation.
Comment #21
smustgrave commentedWill agree this does appear to be a duplicate. Other one seems further along and already has test coverage.