Problem/Motivation

When using the "download as unpublished" option in the Lingotek preferences, the paragraph content to also download in an unpublished state as well.

When a user publishes the parent node, the paragraph content remains in an unpublished state and doesn't appear on the page.

Steps to reproduce

Check the "download as unpublished".
Create some content with paragraphs.
Send the content for translation.
Download translation(it will be unpublished at this stage)
Publish the translated content.
The paragraph will remain unpublished.

Proposed resolution

Publish the paragraph as well when parent content is published

Remaining tasks

Apply patch
Add automated tests

User interface changes

API changes

Data model changes

Comments

jahanzaib_at_straker created an issue. See original summary.

penyaskito’s picture

Title: D8/D9: When using "Download as Unpublished" option in Lingotek module, Paragraphs remain unpublished when parent node is published. » When using "Download as Unpublished" option in Lingotek module, Paragraphs remain unpublished when parent node is published.
Version: 4.0.0 » 4.0.x-dev
jahanzaib_at_straker’s picture

.only-test.patch indicating failure

jahanzaib_at_straker’s picture

StatusFileSize
new9.3 KB

paragraphs will now be published.

penyaskito’s picture

Status: Active » Needs review

Changing status to needs review so the testbot runs.

The last submitted patch, 3: 3319591-paragraphs-published-3.only-tests.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

penyaskito’s picture

Status: Needs review » Needs work

Hurray! Well done! Tests passed and failed as expected.

Some comments though:

  1. +++ b/src/LingotekContentTranslationService.php
    @@ -1404,6 +1404,9 @@ class LingotekContentTranslationService implements LingotekContentTranslationSer
    +        if ($entity->getEntityTypeId() === 'paragraph' || $entity->getEntityTypeId() === 'paragraphs') {
    

    We only need to check for paragraph here, now that we detected the issue.

  2. +++ b/tests/src/Functional/LingotekNodeParagraphsTranslationStatusTest.php
    @@ -0,0 +1,200 @@
    +  public static $modules = ['block', 'content_moderation', 'workflows', 'node', 'image', 'comment', 'paragraphs', 'lingotek_paragraphs_test'];
    

    We don't need workflows nor content_moderation here, remove them from the array to speed up tests.

  3. +++ b/tests/src/Functional/LingotekNodeParagraphsTranslationStatusTest.php
    @@ -0,0 +1,200 @@
    +  public function testStatusChangeNodeWithParagraphsTranslation() {
    

    I'd like to have this as a test method in \Drupal\Tests\lingotek\Functional\LingotekNodeParagraphsTranslationTest instead of his own test class, as we have other tests extending that one for testing different translatability scenarios (e.g. \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsTranslationTest). This way we can test if this works on those scenarios too.

jahanzaib_at_straker’s picture

#1 and #3 are fixed.
#2 Those are needed by other tests in \Drupal\Tests\lingotek\Functional\LingotekNodeParagraphsTranslationTest
Here are the patches(only.test and with fix).

jahanzaib_at_straker’s picture

Status: Needs work » Needs review

The last submitted patch, 8: 3319591-paragraphs-published-8.only-tests.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

penyaskito’s picture

Adjusted coding standards and some assertions for consistency. This fixes the issue. Thanks!

The last submitted patch, 11: 3319591-paragraphs-published-11.only-tests.patch, failed testing. View results

  • penyaskito committed 2b8dff9 on 4.0.x
    Issue #3319591 by jahanzaib_at_straker, penyaskito: When using "Download...
penyaskito’s picture

Status: Needs review » Fixed

Committed 2b8dff9 and pushed to 4.0.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.