-
Notifications
You must be signed in to change notification settings - Fork 6
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-3265: Disabled User account form during translation #61
Conversation
$isTranslation = $formData instanceof ContentUpdateData; | ||
if ($isTranslation) { | ||
return; | ||
} |
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.
Why are you now verifying instance of ContentUpdateData
instead? If it's needed, at least $isTranslation
should be properly renamed. Besides, since this variable is used only once, maybe:
$isTranslation = $formData instanceof ContentUpdateData; | |
if ($isTranslation) { | |
return; | |
} | |
if ($formData instanceof ContentUpdateData) { | |
return; | |
} |
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.
Because ContentUpdateData is used when translating
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 the root of the bug? That ContentUpdateData
is used for User instead of ContentTranslationData
?
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.
@ViniTou @konradoboza
translating action goes through proxyTranslateAction
and then, its response is always content/edit/draft
, then hits editVersionDraftAction
and then we are in ContentEditViewFilter
when we are using ContentUpdateMapper
-> ContentUpdateData
. The same happens for every other content which seems logical because we are in fact editing drafts when translating.
Besides even in TranslationFormProcessor
ContentUpdateData
is built.
The source of the bug is the fact that at this point in the form we don't have UserCreateData
and UserUpdateData
. There is no such thing as UserTranslateData
at all. Every translation ends up with ContentUpdateData
.
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.
Thanks for the clarification. Not sure if we want to block translating users from the business point of view though. Besides, obtaining content type via $rootForm->getData()->contentDraft->contentType
seems to work.
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.
Okay, but ContentTranslationData
is not used when translating any content, not just user one.
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.
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.
Customer Group is rather a separate object not a Field Type so the approach is quite different there. brainfart 😓
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.
I'll put this topic on hold until we decide how it should really work and by that I mean:
- usage of
ContentTranslationData
- UI behavior (should we hide the form? should we show it as disabled? - JS validation has to be fixed in this case)
- external storage behavior - should the
user_account
data be copied? set to null? don't insert anything?
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.
As I said, it is the same issue here then:
https://github.com/ibexa/product-catalog/blob/main/src/bundle/FieldType/CustomerGroup/FieldValueFormMapper.php#L23
I would say, we should use ContentTranslationData/UserTranslationData
if needed.
And show form as disabled, as we did till now.
Even in the PR title you stated disabling and not hiding/removing ;)
But I agree, we can wait for some proper decisions.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
], | ||
]); | ||
|
||
if ($isTranslation) { | ||
$formBuilder->addModelTransformer($this->getModelTransformerForTranslation($fieldDefinition)); |
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.
getModelTransformerForTranslation
method should be deprecated as it's not used anymore.
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.
@adamwojs could you, please, take a look at #61 (comment)? This PR has to be put on hold until we decide what to do with content translating, as discussed:
Creating - userCreateData
(instead of contentCreateData
)
Updating - userUpdateData
(instead of contentUpdateData
)
Translating - contentUpdateData
(standard across all contents)
Dawid says we should use contentTranslateData
system-wise but we have not been using it at all anywhere. Could you please share your point of view on this?
Looking into 4.x code I see that translation mode check is based on ibexa/content-forms@92ce5c0 backport might solve the issue for 3.3 branch as well. |
@barw4 are you willing to continue work on this issue ? |
@adamwojs yes, I'll take care of it probably next week |
@adamwojs after going back to the topic, here are some conclusions:
|
The issue was much more extensive and I start to believe it may never worked correctly or became broken a long time ago. Even if it worked in the past, introducing autosave feature definitely messed it up as we changed translation interface to generic content update form. I cleared it up in #63 and now it uses translation form as intended + disables user field and only lets update translatable fields (name, last name etc.). I'm closing this PR in favor of #63. |
As the title states.
Checklist:
$ composer fix-cs
)