summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-08-04 20:06:02 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-08-04 20:06:09 +0200
commitfefa659dd41478fcb5663badb9e3a6130fff3b8f (patch)
treed33d294c4a2f61cc07c25cf2d3958e4d65691cca
parentf7dbf6d1a4b5724445de4da658103ce976b02a29 (diff)
downloadgitlab-ci-fix-projects-api-empty-list.tar.gz
Fix project API listing returning empty list when first projects are not added to CIfix-projects-api-empty-list
The CI prefers to receive the projects added to CI first
-rw-r--r--CHANGELOG1
-rw-r--r--lib/api/projects.rb4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8b7af68..6507f0f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@ v7.14.0 (unreleased)
- Randomize test database for CI tests
- Make YAML validation stricter
- Use avatars received from GitLab
+ - Fix project API listing returning empty list when first projects are not added to CI
v7.13.1
- Fix: user could steal specific runner
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 0311c56..58539d3 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -34,7 +34,7 @@ module API
# GET /projects
get do
gitlab_projects = Project.from_gitlab(
- current_user, :authorized, { page: params[:page], per_page: params[:per_page] }
+ current_user, :authorized, { page: params[:page], per_page: params[:per_page], ci_enabled_first: true }
)
ids = gitlab_projects.map { |project| project.id }
@@ -48,7 +48,7 @@ module API
# GET /projects/owned
get "owned" do
gitlab_projects = Project.from_gitlab(
- current_user, :owned, { page: params[:page], per_page: params[:per_page] }
+ current_user, :owned, { page: params[:page], per_page: params[:per_page], ci_enabled_first: true }
)
ids = gitlab_projects.map { |project| project.id }