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:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-12 20:13:25 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-12 20:13:25 +0300
commit1065f3d30b0d793fc0b944cc9d19c8e9858ae08a (patch)
treeb57bd1c500e27893729104f3ef69cbc5e7cb7dff
parent59621e90343789a8d45326814e8dc85c79390369 (diff)
parent3175438f02ca4bc0469aca097e02b2671865ef43 (diff)
Merge branch 'github-org-repos' into 'master'
Fix missing GitHub organisation repositories on import page. Private repositories belonging to organizations rather than users can't be imported because `client.repos(org.login)` was requesting `/users/:org_login/repos` (which only returns public org repo's), while we need `/orgs/:org_login/repos` (which includes both public and private). The `client.org_repos` method does this. cc @marin This is a bug in 7.8.x, but I'm not sure if it needs a minor release now or if it can go in 7.9. See merge request !1683
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/import/github_controller.rb2
-rw-r--r--spec/controllers/import/github_controller_spec.rb7
3 files changed, 7 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 21564b6f890..abb47191f89 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -62,6 +62,7 @@ v 7.8.4
v 7.8.3
- Bump version of gitlab_git fixing annotated tags without message
- Allow smb:// links in Markdown text.
+ - Fix missing GitHub organisation repositories on import page.
v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index dc7668ee6fd..8650b6464dc 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -14,7 +14,7 @@ class Import::GithubController < Import::BaseController
def status
@repos = client.repos
client.orgs.each do |org|
- @repos += client.repos(org.login)
+ @repos += client.org_repos(org.login)
end
@already_added_projects = current_user.created_projects.where(import_type: "github")
diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb
index b8820413406..5b967bfcc0c 100644
--- a/spec/controllers/import/github_controller_spec.rb
+++ b/spec/controllers/import/github_controller_spec.rb
@@ -27,17 +27,20 @@ describe Import::GithubController do
describe "GET status" do
before do
@repo = OpenStruct.new(login: 'vim', full_name: 'asd/vim')
+ @org = OpenStruct.new(login: 'company')
+ @org_repo = OpenStruct.new(login: 'company', full_name: 'company/repo')
end
it "assigns variables" do
@project = create(:project, import_type: 'github', creator_id: user.id)
controller.stub_chain(:client, :repos).and_return([@repo])
- controller.stub_chain(:client, :orgs).and_return([])
+ controller.stub_chain(:client, :orgs).and_return([@org])
+ controller.stub_chain(:client, :org_repos).with(@org.login).and_return([@org_repo])
get :status
expect(assigns(:already_added_projects)).to eq([@project])
- expect(assigns(:repos)).to eq([@repo])
+ expect(assigns(:repos)).to eq([@repo, @org_repo])
end
it "does not show already added project" do