A platform for community discussion. Free, open, simple.
FIX: ensures category order keeps consistent (#10165)
Joffrey JAFFEUX9b7000dbf109
diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js b/app/assets/javascripts/discourse/app/controllers/discovery/topics.jsindex 2434da4c613..3ea86d344a8 100644--- a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js+++ b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js@@ -21,7 +21,7 @@ const controllerOpts = {showTopicPostBadges: not("discoveryTopics.new"),redirectedReason: alias("currentUser.redirected_to_top.reason"),- order: "default",+ order: null,ascending: false,expandGloballyPinned: false,expandAllPinned: false,@@ -37,11 +37,11 @@ const controllerOpts = {changeSort(sortBy) {if (sortBy === this.order) {this.toggleProperty("ascending");+ this.model.refreshSort(sortBy, this.ascending);} else {this.setProperties({ order: sortBy, ascending: false });+ this.model.refreshSort(sortBy, false);}-- this.model.refreshSort(sortBy, this.ascending);},// Show newly inserted topicsdiff --git a/lib/topic_query.rb b/lib/topic_query.rbindex 5f8658661b4..d8cdfe828bc 100644--- a/lib/topic_query.rb+++ b/lib/topic_query.rb@@ -684,6 +684,9 @@ class TopicQueryif sort_orderoptions[:order] = sort_orderoptions[:ascending] = !!sort_ascending ? 'true' : 'false'+ else+ options[:order] = 'default'+ options[:ascending] = 'false'endendend