Skip to content

A platform for community discussion. Free, open, simple.

FIX: Client should be able to route ID-less topic URLs (#15697)

Osama Sayegha742952c8d26
diff --git a/app/assets/javascripts/discourse/app/routes/topic-by-slug-or-id.js b/app/assets/javascripts/discourse/app/routes/topic-by-slug-or-id.js
index 459fce0904a..4471e41869e 100644
--- a/app/assets/javascripts/discourse/app/routes/topic-by-slug-or-id.js
+++ b/app/assets/javascripts/discourse/app/routes/topic-by-slug-or-id.js
@@ -9,7 +9,9 @@ export default DiscourseRoute.extend({
if (params.slugOrId.match(ID_CONSTRAINT)) {
return { url: `/t/topic/${params.slugOrId}` };
} else {
- return Topic.idForSlug(params.slugOrId);
+ return Topic.idForSlug(params.slugOrId).then((data) => {
+ return { url: `/t/${data.slug}/${data.topic_id}` };
+ });
}
},