A platform for community discussion. Free, open, simple.
FIX: Reset max_posts query parameter (#10334)
Bianca Nenciu12913a46e4e6
diff --git a/app/assets/javascripts/discourse/app/routes/build-category-route.js b/app/assets/javascripts/discourse/app/routes/build-category-route.jsindex a28b6c84710..aab3d9c039a 100644--- a/app/assets/javascripts/discourse/app/routes/build-category-route.js+++ b/app/assets/javascripts/discourse/app/routes/build-category-route.js@@ -10,6 +10,7 @@ import PermissionType from "discourse/models/permission-type";import CategoryList from "discourse/models/category-list";import Category from "discourse/models/category";import { Promise, all } from "rsvp";+import { action } from "@ember/object";// A helper function to create a category route with parametersexport default (filterArg, params) => {@@ -229,9 +230,26 @@ export default (filterArg, params) => {});},+ resetParams(controller) {+ controller.setProperties({+ order: "default",+ ascending: false,+ max_posts: null+ });+ },++ @action+ willTransition() {+ this._super(...arguments);++ if (this.controller) {+ this.resetParams(this.controller);+ }+ },+resetController(controller, isExiting) {if (isExiting) {- controller.setProperties({ order: "default", ascending: false });+ this.resetParams(controller);}},diff --git a/app/assets/javascripts/discourse/app/routes/build-topic-route.js b/app/assets/javascripts/discourse/app/routes/build-topic-route.jsindex f623bf0b5c3..cfa069fed0c 100644--- a/app/assets/javascripts/discourse/app/routes/build-topic-route.js+++ b/app/assets/javascripts/discourse/app/routes/build-topic-route.js@@ -6,6 +6,7 @@ import { defaultHomepage } from "discourse/lib/utilities";import Session from "discourse/models/session";import { Promise } from "rsvp";import Site from "discourse/models/site";+import { action } from "@ember/object";// A helper to build a topic route for a filterfunction filterQueryParams(params, defaultParams) {@@ -147,9 +148,26 @@ export default function(filter, extras) {);},+ resetParams(controller) {+ controller.setProperties({+ order: "default",+ ascending: false,+ max_posts: null+ });+ },++ @action+ willTransition() {+ this._super(...arguments);++ if (this.controller) {+ this.resetParams(this.controller);+ }+ },+resetController(controller, isExiting) {if (isExiting) {- controller.setProperties({ order: "default", ascending: false });+ this.resetParams(controller);}},