mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: ensures period-chooser is not losing query params (#10534)
eg repro before: - visit http://pr-discourse.test/top/weekly?f=foo - select another period in the period chooser - f=foo was gone After this commit it should still be present
This commit is contained in:
@@ -3,11 +3,13 @@ import Controller, { inject as controller } from "@ember/controller";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import Category from "discourse/models/category";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Controller.extend({
|
||||
discoveryTopics: controller("discovery/topics"),
|
||||
navigationCategory: controller("navigation/category"),
|
||||
application: controller(),
|
||||
router: service(),
|
||||
|
||||
loading: false,
|
||||
|
||||
@@ -32,6 +34,16 @@ export default Controller.extend({
|
||||
}
|
||||
|
||||
url += "/top/" + period;
|
||||
|
||||
const queryParams = this.router.currentRoute.queryParams;
|
||||
if (Object.keys(queryParams).length) {
|
||||
url =
|
||||
`${url}?` +
|
||||
Object.keys(queryParams)
|
||||
.map(key => `${key}=${queryParams[key]}`)
|
||||
.join("&");
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user