summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-05-14 15:49:09 +0300
committerValery Sizov <vsv2711@gmail.com>2015-05-14 15:49:09 +0300
commit7c3ca86370afd28306e5bcc6563ff03da0343536 (patch)
tree366873e8e1ddcb03911c4339c024fa99962c73ec /lib
parent5619c7b9687edbeb07f4f383bd0bd1a1d94a1b50 (diff)
downloadgitlab-ce-7c3ca86370afd28306e5bcc6563ff03da0343536.tar.gz
Add order option for projects API
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index e3fff79d68f..1f2251c9b9c 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -22,7 +22,12 @@ module API
projects = projects.search(params[:search])
end
- projects.reorder(project_order_by => project_sort)
+ if params[:ci_enabled_first].present?
+ projects.includes(:gitlab_ci_service).
+ reorder("services.active DESC, projects.#{project_order_by} #{project_sort}")
+ else
+ projects.reorder(project_order_by => project_sort)
+ end
end
def project_order_by