diff options
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/services/projects/fork_service.rb | 5 | ||||
-rw-r--r-- | spec/services/projects/fork_service_spec.rb | 21 |
4 files changed, 19 insertions, 13 deletions
@@ -157,7 +157,7 @@ gem 'github-markup', '~> 1.7.0', require: 'github/markup' gem 'commonmarker', '~> 0.21' gem 'kramdown', '~> 2.3.1' gem 'RedCloth', '~> 4.3.2' -gem 'rdoc', '~> 6.1.2' +gem 'gitlab-rdoc', '~> 6.3.2', require: 'rdoc' # We need this fork until rdoc releases a new version. See https://gitlab.com/gitlab-org/gitlab/-/issues/334695 gem 'org-ruby', '~> 0.9.12' gem 'creole', '~> 0.5.0' gem 'wikicloth', '0.8.1' diff --git a/Gemfile.lock b/Gemfile.lock index 1794a40c85c..0555f933922 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -500,6 +500,7 @@ GEM openid_connect (~> 1.2) gitlab-pg_query (2.0.4) google-protobuf (>= 3.17.1) + gitlab-rdoc (6.3.2) gitlab-sidekiq-fetcher (0.5.6) sidekiq (~> 5) gitlab-styles (6.2.0) @@ -1024,7 +1025,6 @@ GEM msgpack (>= 0.4.3) optimist (>= 3.0.0) rchardet (1.8.0) - rdoc (6.1.2) re2 (1.2.0) recaptcha (4.13.1) json @@ -1497,6 +1497,7 @@ DEPENDENCIES gitlab-net-dns (~> 0.9.1) gitlab-omniauth-openid-connect (~> 0.4.0) gitlab-pg_query (~> 2.0.4) + gitlab-rdoc (~> 6.3.2) gitlab-sidekiq-fetcher (= 0.5.6) gitlab-styles (~> 6.2.0) gitlab_chronic_duration (~> 0.10.6.2) @@ -1605,7 +1606,6 @@ DEPENDENCIES rainbow (~> 3.0) rblineprof (~> 0.3.6) rbtrace (~> 0.4) - rdoc (~> 6.1.2) re2 (~> 1.2.0) recaptcha (~> 4.11) redis (~> 4.0) diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb index fd9b64a4ee0..3cee1b5975a 100644 --- a/app/services/projects/fork_service.rb +++ b/app/services/projects/fork_service.rb @@ -34,8 +34,9 @@ module Projects new_project = CreateService.new(current_user, new_fork_params).execute return new_project unless new_project.persisted? - builds_access_level = @project.project_feature.builds_access_level - new_project.project_feature.update(builds_access_level: builds_access_level) + new_project.project_feature.update!( + @project.project_feature.slice(ProjectFeature::FEATURES.map { |f| "#{f}_access_level" }) + ) new_project end diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 276656656ec..d710e4a777f 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -184,14 +184,6 @@ RSpec.describe Projects::ForkService do end end - context 'GitLab CI is enabled' do - it "forks and enables CI for fork" do - @from_project.enable_ci - @to_project = fork_project(@from_project, @to_user, using_service: true) - expect(@to_project.builds_enabled?).to be_truthy - end - end - context "CI/CD settings" do let(:to_project) { fork_project(@from_project, @to_user, using_service: true) } @@ -366,6 +358,19 @@ RSpec.describe Projects::ForkService do expect(forked_project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE) end + + it 'copies project features visibility settings to the fork', :aggregate_failures do + attrs = ProjectFeature::FEATURES.to_h do |f| + ["#{f}_access_level", ProjectFeature::PRIVATE] + end + + public_project.project_feature.update!(attrs) + + user = create(:user, developer_projects: [public_project]) + forked_project = described_class.new(public_project, user).execute + + expect(forked_project.project_feature.slice(attrs.keys)).to eq(attrs) + end end end |