simonk
(Simon King)
8월 7, 2026, 2:36오후
1
Creating a link to start a new topic with pre-filled information 에서 이어지는 토론입니다.
이것이 버그인지 기능인지 확실하지 않지만, new-topic 링크에 category 또는 category_id 매개변수가 포함된 경우 링크를 클릭하면 작성기를 열기 전에 해당 범주로 이동합니다. 예를 들어, 이 링크를 클릭하면 작성기를 열기 전에 Support 범주로 이동합니다:
https://meta.discourse.org/new-topic?title=topic%20title&category=Support
Discourse가 현재 페이지에서 벗어나지 않기를 선호합니다. 이를 달성할 수 있는 방법이 있을까요?
simonk
(Simon King)
8월 7, 2026, 2:49오후
2
이 변경 사항은 사용자가 이미 Discourse에 있었다면 내비게이션을 중단합니다:
committed 12:03AM - 27 Jun 23 UTC
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.
이후 코드가 변경되어 현재는 다음과 같습니다:
async beforeModel(transition) {
if (!this.currentUser) {
transition.send("showLogin");
return;
}
const { queryParams: params } = transition.to;
const category = await this.#loadCategoryFromTransition(params);
if (category) {
// Using URL-based transition to avoid bug with dynamic segments and refreshModel query params
// https://github.com/emberjs/ember.js/issues/16992
this.router
.replaceWith(`/c/${category.id}`)
.followRedirects()
.then(() => {
if (this.currentUser.can_create_topic) {
this.#openComposer(params, category);
}
});
if (category) { 블록은 사용자가 이미 discourse에 있었는지 확인하는 블록보다 앞서 실행되므로 내비게이션이 진행됩니다. 제 생각에는 순서가 잘못되었습니다.