summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wyatt <daniel.wyatt@ribose.com>2019-04-08 10:12:39 -0400
committerDaniel Wyatt <daniel.wyatt@ribose.com>2019-04-08 11:39:57 -0400
commit26fdcf7b6103aa47943271a5f6358d9779d5a9b3 (patch)
treef31ef311540088f806818da38b0704e153425a25
parent34f68b3e35bbfa35cb831c16643eadb4dda70039 (diff)
downloadgitlab-ce-26fdcf7b6103aa47943271a5f6358d9779d5a9b3.tar.gz
Fix GitHub project import visibility
-rw-r--r--changelogs/unreleased/47327-fix-github-import-visibility.yml5
-rw-r--r--lib/gitlab/legacy_github_import/project_creator.rb2
-rw-r--r--spec/lib/gitlab/legacy_github_import/project_creator_spec.rb4
3 files changed, 8 insertions, 3 deletions
diff --git a/changelogs/unreleased/47327-fix-github-import-visibility.yml b/changelogs/unreleased/47327-fix-github-import-visibility.yml
new file mode 100644
index 00000000000..0623c8ecd1d
--- /dev/null
+++ b/changelogs/unreleased/47327-fix-github-import-visibility.yml
@@ -0,0 +1,5 @@
+---
+title: Fix GitHub project import visibility
+merge_request:
+author: Daniel Wyatt
+type: fixed
diff --git a/lib/gitlab/legacy_github_import/project_creator.rb b/lib/gitlab/legacy_github_import/project_creator.rb
index ca1a1b8e9bd..b484b69c932 100644
--- a/lib/gitlab/legacy_github_import/project_creator.rb
+++ b/lib/gitlab/legacy_github_import/project_creator.rb
@@ -37,7 +37,7 @@ module Gitlab
end
def visibility_level
- visibility_level = repo.private ? Gitlab::VisibilityLevel::PRIVATE : Gitlab::VisibilityLevel::PUBLIC
+ visibility_level = repo.private ? Gitlab::VisibilityLevel::PRIVATE : @namespace.visibility_level
visibility_level = Gitlab::CurrentSettings.default_project_visibility if Gitlab::CurrentSettings.restricted_visibility_levels.include?(visibility_level)
visibility_level
diff --git a/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb b/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
index 3d4240fa4ba..8c56622e0ba 100644
--- a/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
@@ -47,12 +47,12 @@ describe Gitlab::LegacyGithubImport::ProjectCreator do
end
context 'when GitHub project is public' do
- it 'sets project visibility to public' do
+ it 'sets project visibility to namespace visibility level' do
repo.private = false
project = service.execute
- expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC)
+ expect(project.visibility_level).to eq(namespace.visibility_level)
end
end