Correctly check if an error page can be duplicated
Currently, if you have an error_404 (or other error) page in a root page, you cannot duplicate it. That's because the voter checks if such a page already exists in the current root. We need to allow copying if any other root page does not have that type.
Isn‘t the permission to copy a page independent of whether there is a root page to paste it?
we currently prevent to create multiple error_404 etc. pages inside the same root page, because only one should exist.
I know. But I should still be able to copy it even if there is no option to paste it. The paste action is what we should prevent, not the copy action.
The paste action is already prevented. But why would I copy if I cannot paste it anywhere?
Currently, if you have an error_404 (or other error) page in a root page, you cannot duplicate it.
To prevent issues like this one. 😄
?? Thats what this PR fixes?
You don‘t get the point. The copy operation should always be allowed, independent of hasPageTypeInRoot().
You don‘t get the point. The copy operation should always be allowed, independent of
hasPageTypeInRoot().
why? Why would I copy a page if I cannot paste it?
Because these are two different operations that have nothing to do with each other.
- Copy.
- Paste.
Yes, that fails if a 404 page exists under every root page. But
- Copy.
- Delete an existing 404 page.
- Paste the duplicated page.
would not fail. However, your logic would prevent it for no reason.