Cannot add new translation if the latest affected translation revision of the source language is older than the default revision

Created on 22 May 2019, over 5 years ago
Updated 19 September 2024, 3 months ago

Problem/Motivation

The content translation controller add translation page looks to see if the latest revision of an entity is a pending revision, and if it is, loads the latest affected translation revision of the source language, to populate the content entity form. When this happens, the latest affected translation revision can be older than the default revision. This causes the entity changed constraint to fail because it compares all the timestamps of the translations of the (older) source LAT revision to the (newer) default revision and fails.

Proposed resolution

I *think* the controller should load the default revision if the source language LAT revision is older than the default revision, but I'm not sure if this will cause other problems.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Content translationย  โ†’

Last updated 2 days ago

No maintainer
Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States mikelutz Michigan, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot โ†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands seanB Netherlands

    I just ran into the same issue working with translations and content moderation. Specifically when:

    1. The user adds a translation (from EN to NL for example).
    2. The user publishes both EN and NL.
    3. The user then removes the NL translation.
    4. More revisions are made for EN (these revisions no longer have a copy of the NL translation since it has been removed).
    5. The the user visits the translation overview, somehow it seems the NL translation still exists, so the user can't create a new translation, and is also not able to delete the NL translation.

    When I tried the latest patch I still found two issues:

    • The translation overview uses the latest translation affected revision. Which made it seem like the NL translation could not be removed (since the NL langcode had an older translation affected revision). We should probably also check here if the latest translation affected revision is newer than the default.
    • The entity repository EntityRepository::getActive() also loads the latest translation affected revision. This prevented creating a new translation from the default revision.

    An updated patch is attached.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands seanB Netherlands

    If the default revision still contains the translation, we can still allow older revisions to be loaded.

  • Merge request !9345Resolve #3056440 "Cannot add new" โ†’ (Open) created by seanB
  • Pipeline finished with Failed
    4 months ago
    Total: 151s
    #266572
  • Pipeline finished with Failed
    4 months ago
    Total: 259s
    #266579
  • Pipeline finished with Failed
    4 months ago
    Total: 695s
    #266580
  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Appears to have some test failures

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sahana _N

    sahana _n โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sahana _N

    Hi

    I tried to fix the text cases ContentTranslationAddTranslationTest is working fine now.

    On the Run of the test case, I got an Error

    sahana.n@drupal-11-web:/var/www/html$ vendor/bin/phpunit --configuration phpunit.xml  core/modules/content_translation/tests/src/Functional/ContentTranslationAddTranslationTest.php
    PHPUnit 10.5.20 by Sebastian Bergmann and contributors.
    Runtime:       PHP 8.3.8
    Configuration: /var/www/html/phpunit.xml
    
    F                                                                   1 / 1 (100%)
    
    Time: 00:01.862, Memory: 4.00 MB
    
    There was 1 failure:
    
    1) Drupal\Tests\content_translation\Functional\ContentTranslationAddTranslationTest::testWithOlderSourceTranslation
    Behat\Mink\Exception\ElementNotFoundException: Button with id|name|label|value "Save" not found.
    
    /var/www/html/core/tests/Drupal/Tests/WebAssert.php:158
    /var/www/html/core/tests/Drupal/Tests/UiHelperTrait.php:78
    /var/www/html/core/modules/content_translation/tests/src/Functional/ContentTranslationAddTranslationTest.php:93
    
    FAILURES!
    Tests: 1, Assertions: 2, Failures: 1.

    ContentTranslationAddTranslationTest Extends the ContentTranslationPendingRevisionTestBase
    And here node save was not happening.
    I referred to other test cases of how node save happens and fixed it with the submit form.

    Now ContentTranslationAddTranslationTest is executing properly.

    I am happy to take suggestions if the fix is not appropriate. Please let me know.

    Thank you !!

  • Pipeline finished with Failed
    3 months ago
    Total: 1142s
    #286352
  • Pipeline finished with Failed
    3 months ago
    Total: 437s
    #287024
  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    MR appears to have failures.

  • Pipeline finished with Failed
    3 months ago
    Total: 1371s
    #288201
Production build 0.71.5 2024