BUGFIX: Update of usage of previous asset when an asset property is updated #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if you replace or remove an image from a node the asset usage of the first used image is not updated, when the changes are published. For example if an image is added to a node the usage is correctly set to 1. When this image is then replaced by an other image, the asset usage of the first image stays as 1 and the second image gets a correct asset usage of 1. The expected behaviour is, that the asset usage of the first image should go from 1 to 0.
In this pr the correct class for the
nodeDiscarded
Signal (see here https://github.com/Flowpack/Flowpack.Neos.AssetUsage/pull/11/files#diff-69e3e8da81e0c1cc4f7aff2f36a95d4d52edd92ea5628b312a09970b77cf5868R35) is added and the code order in thebeforeNodePublishing
function is adjusted. The the old image usage needs to be update (see here https://github.com/Flowpack/Flowpack.Neos.AssetUsage/pull/11/files#diff-ad82dc394f028c9fdc2b8d83ceb45b47980d9b94954827a3126feab8b1afb102L216) before one can check whether a new image is added (see the checks here https://github.com/Flowpack/Flowpack.Neos.AssetUsage/pull/11/files#diff-ad82dc394f028c9fdc2b8d83ceb45b47980d9b94954827a3126feab8b1afb102R216).With these changes the asset usage for the old image is updated correctly, when a replacement or removal of this image is published. I think, this pr should also fix the issue #2 .