[4.x] TenancyUrlGenerator: override toRoute()#1439
Open
Conversation
Also update `route()` override since `parent::route()` calls `toRoute()` under the hood (similarly to how `parent::temporarySignedRoute()` calls `route()`)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1439 +/- ##
============================================
+ Coverage 86.08% 86.10% +0.02%
Complexity 1148 1148
============================================
Files 184 184
Lines 3363 3362 -1
============================================
Hits 2895 2895
+ Misses 468 467 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The `toRoute()` and `route()` overrides cover `temporarySignedRoute())`, so we don't need to specifically override `temporarySIgnedRoute()` anymore. `route()` override got simplified since everything except for the name prefixing is delegated to the lower-level `toRoute()` method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds the
toRoute()method override toTenancyUrlGenerator.toRoute()now attempts to find a tenant equivalent of the passed route (= a route with the same name as the passed one, but with the tenant prefix) and generates URL for the tenant route. This behavior can be bypassed using the bypass parameter, similarly to theroute()method override inTenancyUrlGenerator.The primary reason for adding this is that Livewire v4 no longer uses the
route()helper (which automatically prefixes the passed route name because of the override inTenancyUrlGenerator) inHandleRequests::getUpdateUri(). Now, it usestoRoute()(livewire/livewire@544aa3d#diff-e7609f8b0a60bde5a85067803d4e2f08f235c7cee9225a51ea67a85ff9a1d694R52), which doesn't automatically swap the route for a route with tenant prefix in tenant context. So for the Livewire integration to work with path identification, we need to overridetoRoute()as described.The
temporarySignedRoute()override got removed becausetemporarySignedRoute()callsroute()under the hood, there's no need to specifically overridetemporarySignedRoute().The
route()override got simplified. Sinceroute()usestoRoute()under the hood, theroute()override only has to have the prefixing logic. The rest gets delegated totoRoute().Comments in TenancyUrlGenerator and UrlGeneratorBootstrapper got updated to be more accurate. All methods we intend to affect are listed in TenancyUrlGenerator's docblock.