Translated Node with Paragraphs will not save on second request

Found a problem when working with translated paragraphs

How to reproduce

  • install drupal 8 beta12
  • install paragraphs and paragraphs_demo
  • install content_translation
  • enable translation on the "Paragraphed article" example content type
  • enable translation on e.g. the "field_text_demo" example paragraphs type
  • create a Paragraphed article with one or more paragraphs and save
  • translate this node and save
  • go back to the original language and save. you will get:

    "The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved."

    and wont be able to save to original language anymore

Further notes

  • when translating: no add or remove buttons on the paragraphs are present
  • updating the translation works, but you can not remove the initial paragraphs created by the original language
  • deleleting the original language paragraphs will not delete the translated ones. Thus the translated paragraphs can not be deleted at the moment

The three above points are due to design, see #2461695: Support asymmetric translations. But the Initial error is still present. I tested it with simplytest.me and was able to reproduce the bug there.

Comments

berdir’s picture

when translating: no add or remove buttons on the paragraphs are present

That is more or less by design. But the effect it has on deleting is definitely not intendted.

miro_dietiker’s picture

Status: Active » Postponed (maintainer needs more info)

See also this issue that explains the situation / limitation: #2461695: Support asymmetric translations

From the README.txt:

- Make sure that the content type with a paragraph field is set to NOT translatable.
- Set the fields of each paragraph type to translatable as required.

Chances are you don't want to do what you did.
If you fix the setup, is the bug still pending?

tassilogroeper’s picture

Issue summary: View changes

@miro_dietiker: updated the setup. the three points of the further notes are solved. But the initial bug still remains.

miro_dietiker’s picture

Status: Postponed (maintainer needs more info) » Active

Back to active then. Will check, provide feedback, fix.

miro_dietiker’s picture

Can reproduce. That's a critical thing indeed.
(Pretty sure this worked once.)
Let's start with extending a test and then identify and fix the issue...

sasanikolic’s picture

This is a core bug. This is an opened issue to fix it.

berdir’s picture

Title: Translated Node with paragraphs throws "The content has either been modified by another user ... your changes cannot be saved." on second save » Test coverage for editing a translation
Category: Bug report » Task
Priority: Critical » Normal

The core issue was fixed, which should have fixed this.

We still want test for this, however so changing to a task.

tduong’s picture

Status: Active » Needs review
StatusFileSize
new3.03 KB

Uploaded patch for issue #2527644:

  • added test coverage for saving the original paragraph article on second request
sasanikolic’s picture

Status: Needs review » Needs work

I think we just need to extend the existing test (testParagraphTranslation()), not add a new one for that, since this adds lots of loading time to our test.
It should be as easy as two lines of code at the end. :)

tduong’s picture

Status: Needs work » Needs review
StatusFileSize
new835 bytes

Uploaded patch:

  • modified testParagraphTranslation() adding the saving command for the original content on second request :)
sasanikolic’s picture

Status: Needs review » Needs work
  1. +++ b/src/Tests/ParagraphsTranslationTest.php
    @@ -120,5 +120,12 @@ class ParagraphsTranslationTest extends WebTestBase {
    +    // Save the original content on second request
    

    Missing dot at the end of the sentence.

  2. +++ b/src/Tests/ParagraphsTranslationTest.php
    @@ -120,5 +120,12 @@ class ParagraphsTranslationTest extends WebTestBase {
    +    $this->assertNoText('The content has either been modified by another user,
    +        or you have already submitted modifications.
    +        As a result, your changes cannot be saved.');
    

    No need for line breaks. You can write one sentence after another, and limit the line to 80 chars.

sasanikolic’s picture

Also, don't forget to post interdiffs.

jeroen.b’s picture

Are we sure that assertNoText works correctly with the line breaks?

miro_dietiker’s picture

I think testing for "The content has either been modified by another user" is perfectly enough.
(But i think it's a redundant check to the "...has been updated." and could be omitted if we check for success explicitly..)

sasanikolic’s picture

Hmm, I checked... It doesn't work correctly with line breaks.

tduong’s picture

Status: Needs work » Needs review
StatusFileSize
new646 bytes
new801 bytes

Uploaded patch:

  • added dot at the end of the sentence :)
  • dropped last assertNoText()

Yes, I also have checked the line break thing and yes, it does not work!

sasanikolic’s picture

Status: Needs review » Reviewed & tested by the community

Not sure if we need the assertNoText() or not. But without is fine for me.

tduong’s picture

To be consistent with the whole method testParagraphTranslation(), we may need also the last assertNoText() as well, since also for // Check the english translation. and // Check the french translation. we do have double checks.
But I also find it a bit redundant (if we successfuly saved the paragraph then the assertNoText() will always pass as well).

  • jeroen.b committed 71ca448 on 8.x-1.x authored by tduong
    Issue #2527644 by tduong: Test coverage for editing a translation
    
jeroen.b’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, pushed to dev!

Status: Fixed » Closed (fixed)

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