Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix: Make it impossible to use the UI to add a reusable block inside the same reusable block #11316
Fixes client-side problems in #11206.
It was possible to use the UI to add a reusable block inside itself. This PR addresses this problem.
In order to address this problem, a new selector isAncestorOf is created.
How has this been tested?
Add a columns block write some paragraphs inside it.
Thank you for your review @noisysocks
For now, I addressed the client-side problem as it is possible to use the UI to trigger it. So after this PR, the bug will only happen using code.
I think the server side problem is hard to trigger/and In my perspective seems something a normal user would not do (unless trying to trigger the bug). One possible solution for the problem would be having a hook on the server the executes when saving posts and if it is saving a reusable block, it would parse the blocks inside iterate on the tree and check if there is not a block referencing its own id.