summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-10-19 10:32:15 -0700
committerStan Hu <stanhu@gmail.com>2015-10-19 10:39:59 -0700
commit4ad64ab3f4705b7fa88f855d67e0d2d268c5e395 (patch)
tree1f20b99cd90089bfd3384e045cb8349786651d54
parent87d710f5a5661f31876fb5423b6cc588230ff8dc (diff)
downloadgitlab-ce-4ad64ab3f4705b7fa88f855d67e0d2d268c5e395.tar.gz
Fix duplicate repositories in GitHub import page
By default, all the current user's repositories are accessible via the /users endpoint. There's no need to traverse all the organization repositories as well. See: * http://www.rubydoc.info/github/pengwynn/octokit/Octokit/Client/Repositories#repositories-instance_method * https://developer.github.com/v3/repos/#list-your-repositories Closes #2523
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/import/github_controller.rb4
-rw-r--r--spec/controllers/import/github_controller_spec.rb2
3 files changed, 2 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 634cf15f946..5671d8b1d81 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 8.2.0 (unreleased)
+ - Fix duplicate repositories in GitHub import page (Stan Hu)
- Show last project commit to default branch on project home page
- Highlight comment based on anchor in URL
- Adds ability to remove the forked relationship from project settings screen. (Han Loong Liauw)
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index aae77d384c6..67bf4190e7e 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -11,10 +11,6 @@ class Import::GithubController < Import::BaseController
def status
@repos = client.repos
- client.orgs.each do |org|
- @repos += client.org_repos(org.login)
- end
-
@already_added_projects = current_user.created_projects.where(import_type: "github")
already_added_projects_names = @already_added_projects.pluck(:import_source)
diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb
index 766be578f7f..bbf8adef534 100644
--- a/spec/controllers/import/github_controller_spec.rb
+++ b/spec/controllers/import/github_controller_spec.rb
@@ -41,7 +41,7 @@ describe Import::GithubController do
it "assigns variables" do
@project = create(:project, import_type: 'github', creator_id: user.id)
- stub_client(repos: [@repo], orgs: [@org], org_repos: [@org_repo])
+ stub_client(repos: [@repo, @org_repo], orgs: [@org], org_repos: [@org_repo])
get :status