-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-6494: Fixed copying of non-translatable fields to later versions #394
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -1517,10 +1517,7 @@ protected function copyNonTranslatableFieldsFromPublishedVersion(APIContent $cur | |||
$publishedContent = $this->internalLoadContentById($versionInfo->getContentInfo()->getId()); | |||
$publishedVersionInfo = $publishedContent->getVersionInfo(); | |||
|
|||
if ( | |||
!$publishedVersionInfo->isPublished() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt that going to break some cases when things are not copied for translations (\Ibexa\Core\Repository\ContentService::copyTranslationsFromPublishedVersion) and then some other fields will be copied here?
Or isnt it going to break publishing older version, with overriding all fields with current ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt that going to break some cases when things are not copied for translations (\Ibexa\Core\Repository\ContentService::copyTranslationsFromPublishedVersion) and then some other fields will be copied here?
Hmm, I cannot see why removing this condition would break that. The updated method only deals with nontranslatable fields and those are not handled in copyTranslationsFromPublishedVersion
.
Or isnt it going to break publishing older version, with overriding all fields with current ones?
I've just tested this and it seems that version 2 (3 is published) properly overridden version 3 so values from version 3 weren't copied into earlier version 2 during publishing if that's what you had in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated method only deals with nontranslatable fields and those are not handled in copyTranslationsFromPublishedVersion.
Yes, my point was, that right now some fields could be copied/not copied there, and be copied/not copied here as the logic now differs.
But I guess, maybe QA will stumble on specific case as I cant come up with proper testing scenario for it.
@@ -1517,10 +1517,7 @@ protected function copyNonTranslatableFieldsFromPublishedVersion(APIContent $cur | |||
$publishedContent = $this->internalLoadContentById($versionInfo->getContentInfo()->getId()); | |||
$publishedVersionInfo = $publishedContent->getVersionInfo(); | |||
|
|||
if ( | |||
!$publishedVersionInfo->isPublished() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated method only deals with nontranslatable fields and those are not handled in copyTranslationsFromPublishedVersion.
Yes, my point was, that right now some fields could be copied/not copied there, and be copied/not copied here as the logic now differs.
But I guess, maybe QA will stumble on specific case as I cant come up with proper testing scenario for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@barw4 could you rebase this PR so we can see the current state of CI.
d785b44
to
38d2838
Compare
Done, will send to QA after it's green |
Note from QA: Ive observed a behaviour that might be a bug;
Without this PR this behaviour is not happening. kernel-394.mov |
@alongosz @ViniTou @konradoboza @Nattfarinn calling for a second review. As @tomaszszopinski noticed the first iteration of this PR fixed the issue from the ticket but broke the original idea for this method (older versions with different languages were not updated properly with non-translatable fields). It's really hard to explain but the newest change will allow changing a value of a non-translatable field with an older published field's value only if a current version is older than a published one. Test was added that validates this update. |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA approved on IbexaDXP 3.3 commerce.
v3.3
The issue was present before the
copyNonTranslatableFieldsFromPublishedVersion
was introduced. However, this method would allow us to handle also the case given in the public ticket.Maintainer update
QA
This fix makes non-translatable fields to be copied regardless of if they're coming from higher or lower version number, so we need some extensive testing both for scenario in the ticket and some other ideas of how Editor could manipulate content and possibly break it. The version number simple math comparison (
>
) was there probably since eZ Publish. However I think this was never a good determinant of if something should be overridden.Side note: would be nice to have in such case a version comparison response which would result in an UI dialog stating that the field changed in some other version, prompting user to choose proper value. But we're nowhere near that yet.
Checklist:
$ composer fix-cs
).@ezsystems/engineering-team
).