-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fixes #18872 currentValue
is not current in Umbraco.BlockList element properties
#18976
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
base: main
Are you sure you want to change the base?
Conversation
Hi there @PeterKvayt, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
I can't understand what the issue is with the failed check. |
currentValue
is not current in Umbraco.BlockList element properties
Hi @PeterKvayt - I'll try to give this a review next week. Before I do though, are you able to update here or on the issue with a practical example of the problem the code concern you've found please? I do agree it looks incorrect, and it seems we should expect a property to behave the same with a block list or when used directly on a content item, but it would be good to understand what "real world" problem it is causing. Partly for prioritisation, and partly to be able to verify that the PR does resolve the issue. Thanks.
This is due to the change you have made in to the signature of this method: |
Hi @AndyButland! |
Okay, so I have a few issues related to this PR:
I encountered the following situation: Initially, I was using the standard document type with the default Umbraco.FileUpload property (which, at the time, was not part of a Block List). Later, I needed to create a custom FileUpload property editor with an additional setting to manage a prefix for the uploaded file path. At that point, I started using my custom FileUpload property editor. Eventually, I needed to use this custom editor within a Block List element property. Since it was a custom property editor, it was allowed to be used within Block List elements — unlike the default Umbraco.FileUpload, which isn't supported in that context. I resolved the issues related to using Umbraco.FileUpload in Block Lists (see: #18755). As a result, I now have a custom FileUpload property editor that can be used inside Block List elements. It also handles file deletion from storage properly, as we're addressing the issue related to invalid current values that previously caused problems. |
Hi @PeterKvayt - I've been reviewing this today and think it's looking good. Working as expected when I step through and I've resolved the breaking change and added some unit tests now to verify the behaviour. I've also enabled the file upload property to be used in the block list - which, from what I read above, has been your aim with the issues you've raised and this PR. Having asked around it seems that this was a restriction in Umbraco 13 but doesn't need to be in 15+, so in theory it should work as expected (particularly with the change you've proposed here). Would you mind taking a look over my changes and see if you can find any issue with the use of the file upload in the block list (or in the normal use as a property directly on a document type) please? Then if all looks good to you I think we can bring this in. |
Prerequisites
Description
Fixes #18872
Here, I am adding additional logic to include in processing the current value.
In the original implementation umbraco set the edited and current value in the following way:

As you can see, the current value was always the same and equal to edited value. This leads to unexpected behavior for property editors, that rely on current value.
In this PR I am parsing currentValue:

and then creating a mapping for edited and current data. Mapping allows us to determine whether the value was cleared or removed (it is if edited was null), or changed (it is if edited and current are not null), or just created (it is if current is null).
In any case, it would be processed in the same way.
Also I have changed the following piece of code:

So now it is now "fake" content property data object, it is a "real".
Also there is an additional fix for
FileUploadPropertyValueEditor
. The fix covers the case when the current value is not just a string, but presented as json string with src value (I have faced with this case during testing).This item has been added to our backlog AB#51895