From e20c82436d62e0abdfefba8eb698d25f41c352e8 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 7 Oct 2014 15:19:17 -0400 Subject: [PATCH] FIX: Clicking "Latest" while ordering by a column should reset the order. --- .../discourse/controllers/discovery/topics.js.es6 | 2 ++ app/assets/javascripts/discourse/lib/url.js | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 7c356c7c820..a25502d663d 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -37,6 +37,8 @@ var controllerOpts = { var filter = this.get('model.filter'), self = this; + this.setProperties({ order: 'default', ascending: false }); + // Don't refresh if we're still loading if (this.get('controllers.discovery.loading')) { return; } diff --git a/app/assets/javascripts/discourse/lib/url.js b/app/assets/javascripts/discourse/lib/url.js index b7fe81d1adc..04624497971 100644 --- a/app/assets/javascripts/discourse/lib/url.js +++ b/app/assets/javascripts/discourse/lib/url.js @@ -250,7 +250,10 @@ Discourse.URL = Em.Object.createWithMixins({ navigatedToHome: function(oldPath, path) { var homepage = Discourse.Utilities.defaultHomepage(); - if (window.history && window.history.pushState && path === "/" && (oldPath === "/" || oldPath === "/" + homepage)) { + if (window.history && + window.history.pushState && + (path === "/" || path === "/" + homepage) && + (oldPath === "/" || oldPath === "/" + homepage)) { this.appEvents.trigger('url:refresh'); return true; }