FIX: Ensure slugless topic URLs are correctly redirected (#24719)
Using `DiscourseURL.routeTo` with `replaceURL: true` wouldn't cause a true Ember redirect. That meant that the transition source would be be replaced in the browser's history stack, and the 'back' button wouldn't work as expected. Instead, we can use the router service to perform a proper redirect.
This commit is contained in:
parent
cae2b83af8
commit
863c0cdecc
|
@ -355,12 +355,8 @@ const TopicRoute = DiscourseRoute.extend({
|
|||
|
||||
model(params, transition) {
|
||||
if (params.slug.match(ID_CONSTRAINT)) {
|
||||
transition.abort();
|
||||
|
||||
DiscourseURL.routeTo(`/t/topic/${params.slug}/${params.id}`, {
|
||||
replaceURL: true,
|
||||
});
|
||||
|
||||
// URL with no slug - redirect to a URL with placeholder slug
|
||||
this.router.transitionTo(`/t/-/${params.slug}/${params.id}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue