summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-02 17:43:37 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-03 02:11:50 +0900
commitf0bc9af36b716066347549de4c0a5a3ec997a983 (patch)
tree53bffc76568edd6004bef3b8f78855e2e1960543 /app/finders
parenta114c988b4c17e37508f1d0f96b93fd8b96d2df9 (diff)
downloadgitlab-ce-f0bc9af36b716066347549de4c0a5a3ec997a983.tar.gz
Fixed the following.
- Fix inappropriate evaluation(casecmp) to regex - Fix missed boolean conversion - Improve spec
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/pipelines_finder.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb
index 5408cc09096..03183efadda 100644
--- a/app/finders/pipelines_finder.rb
+++ b/app/finders/pipelines_finder.rb
@@ -88,8 +88,9 @@ class PipelinesFinder
end
def by_yaml_errors(items)
- if params[:yaml_errors].present?
- if params[:yaml_errors]
+ flg = Gitlab::Utils.to_boolean(params[:yaml_errors])
+ if flg.present?
+ if flg
items.where("yaml_errors IS NOT NULL")
else
items.where("yaml_errors IS NULL")
@@ -102,7 +103,7 @@ class PipelinesFinder
def order_and_sort(items)
if params[:order_by].present? && params[:sort].present? &&
items.column_names.include?(params[:order_by]) &&
- (params[:sort].casecmp('ASC') || params[:sort].casecmp('DESC'))
+ params[:sort] =~ /\A(ASC|DESC)\Z/i
items.reorder(params[:order_by] => params[:sort])
else
items.reorder(id: :desc)