diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2015-08-05 10:15:26 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2015-08-05 10:15:26 +0000 |
commit | 9d95dfe6018a6d039bc4f0d9ff42131b0ff9505c (patch) | |
tree | 5929b1508dd2dbee63aa8a6a8a0646fbf9bbbd23 | |
parent | 0ac87af6ce25abf7e12a63a9cec1a2d10c841196 (diff) | |
parent | 1779c1d49f36fe255adcc12764b70561ecb5c351 (diff) | |
download | gitlab-ci-9d95dfe6018a6d039bc4f0d9ff42131b0ff9505c.tar.gz |
Merge branch 'fix-projects-api-empty-list' into 'master'
Fix project API listing returning empty list when first projects are not added to CI
The CI prefers to receive the projects added to CI first
/cc @vsizov
See merge request !225
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/api/projects.rb | 4 | ||||
-rw-r--r-- | spec/support/stub_gitlab_calls.rb | 4 |
3 files changed, 5 insertions, 4 deletions
@@ -7,6 +7,7 @@ v7.14.0 (unreleased) - Use avatars received from GitLab - Refactor GitLab API usage to use either access_token or private_token depending on what was specified during login - Allow to use access_token for API requests + - Fix project API listing returning empty list when first projects are not added to CI - Added support for CI skipped status 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 } diff --git a/spec/support/stub_gitlab_calls.rb b/spec/support/stub_gitlab_calls.rb index 9efdab0..931ef96 100644 --- a/spec/support/stub_gitlab_calls.rb +++ b/spec/support/stub_gitlab_calls.rb @@ -53,13 +53,13 @@ module StubGitlabCalls def stub_projects f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json')) - stub_request(:get, "#{gitlab_url}api/v3/projects.json?archived=false&private_token=Wvjy2Krpb7y8xi93owUz"). + stub_request(:get, "#{gitlab_url}api/v3/projects.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz"). with(:headers => {'Content-Type'=>'application/json'}). to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'}) end def stub_projects_owned - stub_request(:get, "#{gitlab_url}api/v3/projects/owned.json?archived=false&private_token=Wvjy2Krpb7y8xi93owUz"). + stub_request(:get, "#{gitlab_url}api/v3/projects/owned.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz"). with(:headers => {'Content-Type'=>'application/json'}). to_return(:status => 200, :body => "", :headers => {}) end |