Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preloaded API document Improvements #2754

Merged
merged 5 commits into from
Apr 7, 2021

Conversation

askvortsov1
Copy link
Sponsor Member

Fixes #2752

Changes proposed in this pull request:

  • Fix getting the handler for custom routes, add automated tests to confirm.
  • Invalidate preloadedApiDocument in frontend if URL has changed since page load

Reviewers should focus on:

  • I feel like we might want to make the workaround I included to configure settings before boot as an official method of the testing package. That's probably best as a separate PR though.

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

askvortsov1 and others added 3 commits April 4, 2021 15:03
Also add a test ensuring that the proper handler is used when default route is overriden.
[ci skip] [skip ci]
@askvortsov1 askvortsov1 requested a review from SychO9 April 7, 2021 21:22
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wait to use $this->setting() or should we do that in a different pull request ? it would make sense in a different pull request of there are other places we can use it, which I believe is the case?

@askvortsov1
Copy link
Sponsor Member Author

Should we wait to use $this->setting() or should we do that in a different pull request ? it would make sense in a different pull request of there are other places we can use it, which I believe is the case?

Let's do a separate PR, we'd need to update the used version of flarum/testing, which should definitely not be in this PR.

@SychO9 SychO9 merged commit 40dc6d0 into master Apr 7, 2021
@SychO9 SychO9 deleted the as/preloaded-api-document-improvements branch April 7, 2021 22:25
@SychO9 SychO9 mentioned this pull request Apr 7, 2021
1 task
@@ -204,7 +204,7 @@ protected function setDefaultRoute(RouteCollection $routes)
$factory = $this->container->make(RouteHandlerFactory::class);
$defaultRoute = $this->container->make('flarum.settings')->get('default_route');

if (isset($routes->getRoutes()['GET'][$defaultRoute]['handler'])) {
if (isset($routes->getRouteData()[0]['GET'][$defaultRoute]['handler'])) {
$toDefaultController = $routes->getRoutes()['GET'][$defaultRoute]['handler'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$toDefaultController = $routes->getRoutes()['GET'][$defaultRoute]['handler'];
$toDefaultController = $routes->getRouteData()[0]['GET'][$defaultRoute]['handler'];
Does it need to be modified ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @xiaowu771086986,

Yea we hadn't noticed it at the time and tests didn't catch it, but we did actually fix it not long after here: 1cca4e8

Is this what you meant ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes ,thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All posts appear under any tag
4 participants