FIX: Preserve history when routing to `/filter` route (#29929)

This commit is contained in:
Keegan George 2024-11-27 03:26:25 +09:00 committed by GitHub
parent fd22dd179a
commit 5605bab2c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -1,10 +1,11 @@
import { setTopicList } from "discourse/lib/topic-list-tracker";
import { escapeExpression } from "discourse/lib/utilities";
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class DiscoveryFilterRoute extends DiscourseRoute {
queryParams = {
q: { replace: true, refreshModel: true },
q: { refreshModel: true },
};
async model(data) {
@ -19,7 +20,7 @@ export default class DiscoveryFilterRoute extends DiscourseRoute {
}
titleToken() {
const filterText = i18n("filters.filter.title");
return i18n("filters.with_topics", { filter: filterText });
const query = this.paramsFor(this.routeName).q;
return i18n("filters.filter.title", { filter: escapeExpression(query) });
}
}

View File

@ -4352,7 +4352,7 @@ en:
with_topics: "%{filter} topics"
with_category: "%{filter} %{category} topics"
filter:
title: "Filter"
title: "Filtered results for %{filter}"
button:
label: "Filter"
latest: