From 7b715b61e60e8dc92e48c7cef6ed67ef7ceb6de7 Mon Sep 17 00:00:00 2001 From: Sztig Date: Thu, 9 Jul 2026 16:10:35 +0200 Subject: [PATCH 1/2] fixed content name reverting when translations are published in parallel --- src/lib/Repository/ContentService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/Repository/ContentService.php b/src/lib/Repository/ContentService.php index 9c4fe46152..4243194c1f 100644 --- a/src/lib/Repository/ContentService.php +++ b/src/lib/Repository/ContentService.php @@ -1528,6 +1528,12 @@ protected function copyNonTranslatableFieldsFromPublishedVersion(APIContent $cur $versionInfo = $currentVersionContent->getVersionInfo(); $contentType = $currentVersionContent->getContentType(); + $currentVersionContent = $this->internalLoadContentById( + $versionInfo->getContentInfo()->getId(), + null, + $versionInfo->versionNo + ); + $publishedContent = $this->internalLoadContentById($versionInfo->getContentInfo()->getId()); $publishedVersionInfo = $publishedContent->getVersionInfo(); From b420e8a50569435cd29e01077bb607c6ea9dd407 Mon Sep 17 00:00:00 2001 From: Sztig Date: Thu, 9 Jul 2026 16:11:03 +0200 Subject: [PATCH 2/2] implemented test --- .../Core/Repository/ContentServiceTest.php | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/integration/Core/Repository/ContentServiceTest.php b/tests/integration/Core/Repository/ContentServiceTest.php index b609acec3c..f4864e09ae 100644 --- a/tests/integration/Core/Repository/ContentServiceTest.php +++ b/tests/integration/Core/Repository/ContentServiceTest.php @@ -6573,6 +6573,77 @@ public function testCopyTranslationsFromInvalidPublishedContentToDraft() ); } + public function testCopyTranslationsFromPublishedToDraftWithNonTranslatableField(): void + { + $contentTypeService = $this->getRepository()->getContentTypeService(); + + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct( + 'test_non_translatable_field' + ); + $contentTypeCreateStruct->mainLanguageCode = self::ENG_US; + $contentTypeCreateStruct->names = [self::ENG_US => 'Test content type with non-translatable field']; + $contentTypeCreateStruct->nameSchema = ''; + + $nameField = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $nameField->position = 1; + $nameField->isTranslatable = true; + $contentTypeCreateStruct->addFieldDefinition($nameField); + + $integerField = $contentTypeService->newFieldDefinitionCreateStruct('integer', 'ezinteger'); + $integerField->position = 2; + $integerField->isTranslatable = false; + $contentTypeCreateStruct->addFieldDefinition($integerField); + + $contentTypeService->publishContentTypeDraft( + $contentTypeService->createContentType( + $contentTypeCreateStruct, + [$contentTypeService->loadContentTypeGroupByIdentifier('Content')] + ) + ); + + $contentDraft = $this->createContentDraft( + 'test_non_translatable_field', + $this->generateId('location', 2), + [ + 'name' => 'test', + 'integer' => 1, + ] + ); + $this->contentService->publishVersion($contentDraft->versionInfo); + + $translationDraft = $this->contentService->createContentDraft($contentDraft->contentInfo); + $translationUpdateStruct = new ContentUpdateStruct([ + 'initialLanguageCode' => self::GER_DE, + ]); + $translationUpdateStruct->setField('name', 'test de', self::GER_DE); + $this->contentService->updateContent($translationDraft->versionInfo, $translationUpdateStruct); + $publishedContent = $this->contentService->publishVersion($translationDraft->versionInfo); + + $usDraft = $this->contentService->createContentDraft($publishedContent->contentInfo); + $deDraft = $this->contentService->createContentDraft($publishedContent->contentInfo); + + $usUpdateStruct = new ContentUpdateStruct([ + 'initialLanguageCode' => self::ENG_US, + ]); + $usUpdateStruct->setField('name', 'test updated', self::ENG_US); + $this->contentService->updateContent($usDraft->versionInfo, $usUpdateStruct); + $this->contentService->publishVersion($usDraft->versionInfo, [self::ENG_US]); + + $deUpdateStruct = new ContentUpdateStruct([ + 'initialLanguageCode' => self::GER_DE, + ]); + $deUpdateStruct->setField('name', 'test de updated', self::GER_DE); + $this->contentService->updateContent($deDraft->versionInfo, $deUpdateStruct); + $dePublished = $this->contentService->publishVersion($deDraft->versionInfo, [self::GER_DE]); + + $expectedNames = [ + self::ENG_US => 'test updated', + self::GER_DE => 'test de updated', + ]; + $this->assertEquals($expectedNames, $dePublished->fields['name']); + $this->assertEquals($expectedNames, $dePublished->getVersionInfo()->getNames()); + } + /** * Create structure of parent folders with Locations to be used for Content hide/reveal tests. *