mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 19:57:18 +08:00
FIX: Respect default category sort when filter=default
(#23411)
Previously we would respect it if the filter was `nil`, but if `default` was explicitly passed then it would ignore the category order settings. This explicit passing of `filter=default` happens for some types of navigations in the JS app. This extends the fix from 92bc61b4be9242dd0242ed60641a5129938a231a
This commit is contained in:
@ -1005,6 +1005,17 @@ RSpec.describe TopicQuery do
|
||||
expect(topic_ids - [topic_category.id]).to eq([topic_in_cat1.id, topic_in_cat2.id])
|
||||
end
|
||||
|
||||
it "uses the category's default sort order when filter=default is passed explicitly" do
|
||||
category.update!(sort_order: "created", sort_ascending: true)
|
||||
topic_ids =
|
||||
TopicQuery
|
||||
.new(user, category: category.id, filter: "default")
|
||||
.list_latest
|
||||
.topics
|
||||
.map(&:id)
|
||||
expect(topic_ids - [topic_category.id]).to eq([topic_in_cat1.id, topic_in_cat2.id])
|
||||
end
|
||||
|
||||
it "should apply default sort order to latest and unseen filters only" do
|
||||
category.update!(sort_order: "created", sort_ascending: true)
|
||||
|
||||
|
Reference in New Issue
Block a user