Update valid reasons to not have a template on a content node to include having umbracoRedirect #15929
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.
Prerequisites
If there's an existing issue for this PR then this fixes #15724
Description
In Umbraco 8 it used to be possible to have a doctype with no template assigned and an 'umbracoRedirect' field present that when hit would redirect a user to a chosen page. In Umbraco 10 onwards, this functionality will only work if a template has also been assigned to the doctype. This PR restores the original behaviour.
This appears to happen because:-
To replicate the Umbraco 8 behaviour, I've moved an additional check for 'IsRedirect' to the outer point in UmbracoRouteValuesFactory. As having a redirect field should be a valid reason to not have a template in the first place, this avoids it unnecessarily performing any further checks for the presence of the template and it'll then follow through the redirect behaviour instead.
An alternative way of approaching this could have been to update the inner behaviour on PublishedRouter/UpdateRequestAsync() to copy back in the redirect status after it is cleared. However as this method is used in multiple places changing this could have more of a regression impact.
Testing
To test this:-
Some additional variations validated with this PR:-
Thanks,
Terence