mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 21:53:51 +08:00
Change param asc to ascending
For consistency, change param asc to ascending: https://meta.discourse.org/t/make-admin-users-list-sortable-suggestion/47649/17?u=oblakeerickson
This commit is contained in:
parent
0a41da6bad
commit
e9d5c3265c
|
@ -27,7 +27,7 @@ class AdminUserIndexQuery
|
||||||
end
|
end
|
||||||
|
|
||||||
def custom_direction
|
def custom_direction
|
||||||
asc = params[:asc]
|
asc = params[:ascending]
|
||||||
asc.present? && asc ? "ASC" : "DESC"
|
asc.present? && asc ? "ASC" : "DESC"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ describe AdminUserIndexQuery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows custom ordering asc" do
|
it "allows custom ordering asc" do
|
||||||
query = ::AdminUserIndexQuery.new({ order: "trust_level", asc: true })
|
query = ::AdminUserIndexQuery.new({ order: "trust_level", ascending: true })
|
||||||
expect(query.find_users_query.to_sql).to match("trust_level ASC" )
|
expect(query.find_users_query.to_sql).to match("trust_level ASC" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ describe AdminUserIndexQuery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows custom ordering and direction for stats" do
|
it "allows custom ordering and direction for stats" do
|
||||||
query = ::AdminUserIndexQuery.new({ order: "topics_entered", asc: true })
|
query = ::AdminUserIndexQuery.new({ order: "topics_entered", ascending: true })
|
||||||
expect(query.find_users_query.to_sql).to match("topics_entered ASC")
|
expect(query.find_users_query.to_sql).to match("topics_entered ASC")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -91,7 +91,7 @@ describe AdminUserIndexQuery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows nil values first with asc" do
|
it "shows nil values first with asc" do
|
||||||
users = ::AdminUserIndexQuery.new({ order: "last_emailed_at", asc: true }).find_users
|
users = ::AdminUserIndexQuery.new({ order: "last_emailed_at", ascending: true }).find_users
|
||||||
|
|
||||||
expect(users.count).to eq(2)
|
expect(users.count).to eq(2)
|
||||||
expect(users.first.username).to eq("system")
|
expect(users.first.username).to eq("system")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user