summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-24 16:06:19 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-03 02:11:51 +0900
commit0e8266f2386351906e2d6357282e011d373b2c94 (patch)
tree34dabbb70d716df5ad123875d24210bdc0d83115 /app/finders
parent22a4d124f70598c7c21b08b11db3f38c7bcb71ec (diff)
downloadgitlab-ce-0e8266f2386351906e2d6357282e011d373b2c94.tar.gz
Revert "Use JSON type for sorting parameter (halfway)"
This reverts commit 34127cb13ad72f65a24bdc8fc051363d3edd77cb.
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/pipelines_finder.rb26
1 files changed, 11 insertions, 15 deletions
diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb
index d56cf8fe790..22507472e15 100644
--- a/app/finders/pipelines_finder.rb
+++ b/app/finders/pipelines_finder.rb
@@ -108,20 +108,16 @@ class PipelinesFinder
end
def sort_items(items)
- return items.order(id: :desc) unless params[:sort].present?
- params[:sort].each do |s|
- order_by = if %w[id status ref user_id].include?(s['order_by']) # Allow only indexed columns
- s['order_by']
- else
- :id
- end
- sort = if s['asc_desc'] =~ /\A(ASC|DESC)\z/i
- s['asc_desc']
- else
- :desc
- end
- items = items.order(order_by => sort)
- end
- items
+ order_by = if %w[id status ref user_id].include?(params[:order_by]) # Allow only indexed columns
+ params[:order_by]
+ else
+ :id
+ end
+ sort = if params[:sort] =~ /\A(ASC|DESC)\z/i
+ params[:sort]
+ else
+ :desc
+ end
+ items.order(order_by => sort)
end
end