- π·πΊRussia kala4ek π·πΊ Novosibirsk
Increasing the priority of that ticket, because a lot of code do compare entities in the wrong way now.
Also attached the actual changes from MR as patch, so it can be safely used with composer.
- last update
over 1 year ago 30,341 pass - πΉπ·Turkey makbay
Thanks for the MR and patch but this is still working incorrectly when the latest saved entity is the default version.
Since the patch is checking if the latest version is default or not, in case the latest revision is default (published), the $entity->original again gets the previous default (published) revision instead of the latest revision.
Steps to reproduce after patch
- Enable the Workflows module
- Add Basic Page as applying to the 'Editorial' workflow
- Create and move a basic page through the workflow to published, then set to draft
- Finally, edit the non-default revision (draft) basic page again and set it to ready for review
- In a presave hook, $entity->original will be set to the published revision instead of the draft revision.
- Publish the basic page again.
- Create a new non-default revision (draft). The patch is ok for now, $entity->original will be set to the published version.
- Create another new non-default revision (e.g in review) after the published one. The patch is still ok, $entity->original will be set to the draft version on the previous step.
- Now publish the basic page. The patch will not work here since there is !$entity->isDefaultRevision() check in the condition and $entity->original will be set to the previous published version on step 6.
So, I think we need to remove !$entity->isDefaultRevision() check from the if block.
I'll create another MR for this.
- πΉπ·Turkey makbay
makbay β changed the visibility of the branch 9.2.x to hidden.
- πΉπ·Turkey makbay
makbay β changed the visibility of the branch 11.x to hidden.
- Merge request !6655Issue #3201209: Hook presave does not set original correctly when editing... β (Open) created by makbay