1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

Remove redundant code from IndexPage oninit

This commit is contained in:
Alexander Skvortsov
2020-10-04 22:00:11 -04:00
parent 46cb32046d
commit 759eb80ff9

View File

@@ -29,16 +29,6 @@ export default class IndexPage extends Page {
this.lastDiscussion = app.previous.get('discussion');
}
// If the user is coming from the discussion list, then they have either
// just switched one of the parameters (filter, sort, search) or they
// probably want to refresh the results. We will clear the discussion list
// cache so that results are reloaded.
if (app.previous.matches(IndexPage)) {
app.discussions.clear();
}
app.discussions.refreshParams(app.search.params());
app.history.push('index', app.translator.trans('core.forum.header.back_to_index_tooltip'));
this.bodyClass = 'App--index';
@@ -47,7 +37,13 @@ export default class IndexPage extends Page {
onNewRoute() {
super.onNewRoute();
// If the user is coming from the discussion list, then they have either
// just switched one of the parameters (filter, sort, search) or they
// probably want to refresh the results. We will clear the discussion list
// cache so that results are reloaded.
if (app.previous.matches(IndexPage)) {
app.discussions.clear();
}
app.discussions.refreshParams(app.search.params());