mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:14:12 +08:00
DEV: Standardize table sorting verbiage (#9757)
* DEV: Standardize table sorting verbiage This commit creates a common component that tables can use to make their headers sortable. This commit also standardizes on using `desc` as the default and passing in the `asc=true` flag to adjust the sorting direction. * Add deprecation warnings Adds deprecation warnings if using previous params and maintains backwards compatibility. Set the default sort value for group members to be asc. * switch group requests to use common table-header-toggle * update fixture
This commit is contained in:
@ -29,7 +29,7 @@ describe AdminUserIndexQuery do
|
||||
end
|
||||
|
||||
it "allows custom ordering asc" do
|
||||
query = ::AdminUserIndexQuery.new(order: "trust_level", ascending: true)
|
||||
query = ::AdminUserIndexQuery.new(order: "trust_level", asc: true)
|
||||
expect(query.find_users_query.to_sql).to match("trust_level ASC")
|
||||
end
|
||||
|
||||
@ -39,7 +39,7 @@ describe AdminUserIndexQuery do
|
||||
end
|
||||
|
||||
it "allows custom ordering and direction for stats" do
|
||||
query = ::AdminUserIndexQuery.new(order: "topics_viewed", ascending: true)
|
||||
query = ::AdminUserIndexQuery.new(order: "topics_viewed", asc: true)
|
||||
expect(query.find_users_query.to_sql).to match("topics_entered ASC")
|
||||
end
|
||||
end
|
||||
@ -118,7 +118,7 @@ describe AdminUserIndexQuery do
|
||||
end
|
||||
|
||||
it "shows nil values first with asc" do
|
||||
users = ::AdminUserIndexQuery.new(order: "last_emailed", ascending: true).find_users
|
||||
users = ::AdminUserIndexQuery.new(order: "last_emailed", asc: true).find_users
|
||||
|
||||
expect(users.where('users.id > -2').count).to eq(2)
|
||||
expect(users.where('users.id > -2').order('users.id asc').first.username).to eq("system")
|
||||
|
Reference in New Issue
Block a user