FIX: Reset max_posts query parameter (#10334)

This commit is contained in:
Bianca Nenciu 2020-08-03 11:19:36 +03:00 committed by GitHub
parent ac76bfb400
commit 12913a46e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 2 deletions

View File

@ -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 parameters
export 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);
}
},

View File

@ -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 filter
function 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);
}
},