From 20ced1a55ebed3f4a5d152d79e3c8b91215c4ad6 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 14 Mar 2014 18:13:22 -0400 Subject: [PATCH] FIX: ORDER BY for new topics within current category was second in list, needs to be first --- lib/topic_query.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 5fe83e17c2d..9bdf3ffdfc1 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -285,12 +285,6 @@ class TopicQuery result end - def new_results(options={}) - result = TopicQuery.new_filter(default_results(options), @user.treat_as_new_topic_start_date) - result = remove_muted_categories(result, @user) unless options[:category].present? - suggested_ordering(result, options) - end - def latest_results(options={}) result = default_results(options) result = remove_muted_categories(result, @user) unless options[:category].present? @@ -318,6 +312,12 @@ class TopicQuery suggested_ordering(result, options) end + def new_results(options={}) + result = TopicQuery.new_filter(default_results(options.reverse_merge(:unordered => true)), @user.treat_as_new_topic_start_date) + result = remove_muted_categories(result, @user) unless options[:category].present? + suggested_ordering(result, options) + end + def random_suggested(topic, count, excluded_topic_ids=[]) result = default_results(unordered: true, per_page: count).where(closed: false, archived: false) excluded_topic_ids += Category.pluck(:topic_id).compact