Commit b77cfa78 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 4580824f e861af40
---
title: Fix GitHub project import visibility
merge_request: 27133
author: Daniel Wyatt
type: fixed
......@@ -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
......
......@@ -47,12 +47,22 @@ 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
context 'when importing into a user namespace' do
subject(:service) { described_class.new(repo, repo.name, user.namespace, user, github_access_token: 'asdffg') }
it 'sets project visibility to user namespace visibility level' do
repo.private = false
project = service.execute
expect(project.visibility_level).to eq(user.namespace.visibility_level)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment