From 583226d295ea10ec548d52ac3fc3d7e99628c2eb Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 30 Apr 2019 16:25:25 +0100 Subject: [PATCH] FIX: Linking to `/new-topic` from `/latest` `/new-topic` redirects back to `/latest`, so the ember router considers this to be a 'refresh'. This triggers the `resetParams()` logic, which would cause the transition to abort, and the composer would never open. This commit fixes the `resetParams()` logic so that it uses the default values, instead of setting everything to `null`. Therefore the transition is no longer aborted, and the composer opens successfully. Unfortunately I have not been able to reproduce the issue in a QUnit test. --- .../discourse/controllers/discovery/topics.js.es6 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 3f64d5984eb..6cbce872192 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -25,9 +25,10 @@ const controllerOpts = { expandAllPinned: false, resetParams() { - Object.keys(this.get("model.params") || {}).forEach(key => - this.set(key, null) - ); + Object.keys(this.get("model.params") || {}).forEach(key => { + // controllerOpts contains the default values for parameters, so use them. They might be null. + this.set(key, controllerOpts[key]); + }); }, actions: {