Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index dd9cb2ee019..5fa6d50581b 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -34,10 +34,14 @@ module API
helpers do
# rubocop: disable CodeReuse/ActiveRecord
def reorder_users(users)
- if params[:order_by] && params[:sort]
- users.reorder(order_options_with_tie_breaker)
- else
+ # Users#search orders by exact matches and handles pagination,
+ # so we should prioritize that.
+ if params[:search]
users
+ else
+ # Note that params[:order_by] and params[:sort] will always be present and
+ # default to "id" and "desc" as defined in `sort_params`.
+ users.reorder(order_options_with_tie_breaker)
end
end
# rubocop: enable CodeReuse/ActiveRecord