DEV: Remove deprecated ascending param from AdminUserIndexQuery (#22741)

The parameter ascending was deprecated (replaced by asc) and marked for deletion in 2.9. This PR removes it. Since the resulting code was a simple one-liner, the method body was inlined instead.
This commit is contained in:
Ted Johansson 2023-07-24 09:37:18 +08:00 committed by GitHub
parent 7a790a5f4c
commit 0db98e9d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,22 +33,11 @@ class AdminUserIndexQuery
find_users_query.count
end
def custom_direction
if params[:ascending]
Discourse.deprecate(
":ascending is deprecated please use :asc instead",
output_in_test: true,
drop_from: "2.9.0",
)
end
asc = params[:asc] || params[:ascending]
asc.present? && asc ? "ASC" : "DESC"
end
def initialize_query_with_order(klass)
order = []
custom_order = params[:order]
custom_direction = params[:asc].present? ? "ASC" : "DESC"
if custom_order.present? &&
without_dir = SORTABLE_MAPPING[custom_order.downcase.sub(/ (asc|desc)\z/, "")]
order << "#{without_dir} #{custom_direction}"