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:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-30 13:30:02 +0300
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-02 20:11:51 +0300
commit8653c2dfc943b5536ab99155c8b950e30ba1f567 (patch)
tree0b663afae90a6ebf61ffd1d59498abfd62e2e6fe /app/finders
parent0a36bfa994582b690a7935fed4c15d42b22bd0ed (diff)
Add constant as ALLOWED_INDEXED_COLUMNS
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/pipelines_finder.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb
index c6666802b7f..f187a3b61fe 100644
--- a/app/finders/pipelines_finder.rb
+++ b/app/finders/pipelines_finder.rb
@@ -1,6 +1,8 @@
class PipelinesFinder
attr_reader :project, :pipelines, :params
+ ALLOWED_INDEXED_COLUMNS = %w[id status ref user_id].freeze
+
def initialize(project, params = {})
@project = project
@pipelines = project.pipelines
@@ -95,7 +97,7 @@ class PipelinesFinder
end
def sort_items(items)
- order_by = if %w[id status ref user_id].include?(params[:order_by]) # Allow only indexed columns
+ order_by = if ALLOWED_INDEXED_COLUMNS.include?(params[:order_by])
params[:order_by]
else
:id