mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 01:07:19 +08:00
FIX: use category's default sort order in latest & unseen filters only. (#14571)
Previously, even the top topics filter rendered all the topics in default sort order.
This commit is contained in:
@ -408,6 +408,7 @@ class TopicQuery
|
||||
end
|
||||
|
||||
def create_list(filter, options = {}, topics = nil)
|
||||
options[:filter] ||= filter
|
||||
topics ||= default_results(options)
|
||||
topics = yield(topics) if block_given?
|
||||
|
||||
@ -636,9 +637,10 @@ class TopicQuery
|
||||
result = result.references(:categories)
|
||||
|
||||
if !@options[:order]
|
||||
filter = (options[:filter] || options[:f])
|
||||
# category default sort order
|
||||
sort_order, sort_ascending = Category.where(id: category_id).pluck_first(:sort_order, :sort_ascending)
|
||||
if sort_order
|
||||
if sort_order && (filter.blank? || [:latest, :unseen].include?(filter))
|
||||
options[:order] = sort_order
|
||||
options[:ascending] = !!sort_ascending ? 'true' : 'false'
|
||||
else
|
||||
|
Reference in New Issue
Block a user