mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 17:06:26 +08:00

Why is this change required? The `/new-topic` route is a special route which we use to open the composer by loading a URL. By default, the `new-topic` route is replaced with the `discovery.latest` route. On a fresh page load, this makes sense since there is no template for the `new-topic` route to render. However, this behavior does not make sense if we're transition from another route. There is no need to replace the current route with the `discovery.latest` when all we want is to open the composer. What does this commit do? This commit fixes the undesirable behaviour described above by aborting the existing transition to the `new-topic` route if `transition.from` is present. This indicates that we're navigating from an existing route and we can just open the composer.