Skip to content

Commit

Permalink
DEV: Remove deprecated ascending param from AdminUserIndexQuery (disc…
Browse files Browse the repository at this point in the history
…ourse#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.
  • Loading branch information
Drenmi authored Jul 24, 2023
1 parent 7a790a5 commit 0db98e9
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions lib/admin_user_index_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,11 @@ def count_users
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}"
Expand Down

0 comments on commit 0db98e9

Please sign in to comment.