Commit 2b075638 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'backstage/remove-export-designs-feature-flag' into 'master'

removes `export_designs` feature flags from ee files

Closes #32535

See merge request gitlab-org/gitlab!18507
parents 13f10a0d 1f3b2ff0
---
title: Removes `export_designs` feature flag
merge_request: 18507
author: nate geslin
type: other
...@@ -38,8 +38,6 @@ to be enabled: ...@@ -38,8 +38,6 @@ to be enabled:
- Files uploaded must have a file extension of either `png`, `jpg`, `jpeg`, `gif`, `bmp`, `tiff` or `ico`. - Files uploaded must have a file extension of either `png`, `jpg`, `jpeg`, `gif`, `bmp`, `tiff` or `ico`.
The [`svg` extension is not yet supported](https://gitlab.com/gitlab-org/gitlab/issues/12771). The [`svg` extension is not yet supported](https://gitlab.com/gitlab-org/gitlab/issues/12771).
- Design uploads are limited to 10 files at a time. - Design uploads are limited to 10 files at a time.
- Design Management is
[not yet supported in the project export](https://gitlab.com/gitlab-org/gitlab/issues/11090).
- Design Management data - Design Management data
[isn't deleted when a project is destroyed](https://gitlab.com/gitlab-org/gitlab/issues/13429) yet. [isn't deleted when a project is destroyed](https://gitlab.com/gitlab-org/gitlab/issues/13429) yet.
- Design Management data [won't be moved](https://gitlab.com/gitlab-org/gitlab/issues/13426) - Design Management data [won't be moved](https://gitlab.com/gitlab-org/gitlab/issues/13426)
......
...@@ -12,8 +12,6 @@ module EE::Projects::ImportExport::ExportService ...@@ -12,8 +12,6 @@ module EE::Projects::ImportExport::ExportService
end end
def design_repo_saver def design_repo_saver
return unless Feature.enabled?(:export_designs, project, default_enabled: true)
Gitlab::ImportExport::DesignRepoSaver.new(project: project, shared: shared) Gitlab::ImportExport::DesignRepoSaver.new(project: project, shared: shared)
end end
end end
...@@ -12,8 +12,6 @@ module EE::Gitlab::ImportExport::Importer ...@@ -12,8 +12,6 @@ module EE::Gitlab::ImportExport::Importer
end end
def design_repo_restorer def design_repo_restorer
return unless Feature.enabled?(:export_designs, project, default_enabled: true)
Gitlab::ImportExport::DesignRepoRestorer.new( Gitlab::ImportExport::DesignRepoRestorer.new(
path_to_bundle: design_repo_path, path_to_bundle: design_repo_path,
shared: shared, shared: shared,
......
# frozen_string_literal: true
module EE
module Gitlab
module ImportExport
module ProjectTreeRestorer
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
private
override :remove_feature_dependent_sub_relations!
def remove_feature_dependent_sub_relations!(relation_item)
export_designs_disabled = ::Feature.disabled?(:export_designs, project, default_enabled: true)
if relation_item.is_a?(Hash) && export_designs_disabled
relation_item.except!('designs', 'design_versions')
end
end
end
end
end
end
...@@ -17,74 +17,50 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -17,74 +17,50 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end end
describe 'restoring design management data' do describe 'restoring design management data' do
context 'when the `export_designs` feature is enabled' do before do
before do restored_project_json
restored_project_json end
end
it_behaves_like 'restores project correctly', issues: 2 it_behaves_like 'restores project correctly', issues: 2
it 'restores project associations correctly' do it 'restores project associations correctly' do
expect(project.designs.size).to eq(7) expect(project.designs.size).to eq(7)
end end
describe 'restores issue associations correctly' do describe 'restores issue associations correctly' do
let(:issue) { project.issues.offset(index).first } let(:issue) { project.issues.offset(index).first }
where(:index, :design_filenames, :version_shas) do where(:index, :design_filenames, :version_shas) do
0 | %w[chirrido3.jpg jonathan_richman.jpg mariavontrap.jpeg] | %w[27702d08f5ee021ae938737f84e8fe7c38599e85 9358d1bac8ff300d3d2597adaa2572a20f7f8703 e1a4a501bcb42f291f84e5d04c8f927821542fb6] 0 | %w[chirrido3.jpg jonathan_richman.jpg mariavontrap.jpeg] | %w[27702d08f5ee021ae938737f84e8fe7c38599e85 9358d1bac8ff300d3d2597adaa2572a20f7f8703 e1a4a501bcb42f291f84e5d04c8f927821542fb6]
1 | ['1 (1).jpeg', '2099743.jpg', 'a screenshot (1).jpg', 'chirrido3.jpg'] | %w[73f871b4c8c1d65c62c460635e023179fb53abc4 8587e78ab6bda3bc820a9f014c3be4a21ad4fcc8 c9b5f067f3e892122a4b12b0a25a8089192f3ac8] 1 | ['1 (1).jpeg', '2099743.jpg', 'a screenshot (1).jpg', 'chirrido3.jpg'] | %w[73f871b4c8c1d65c62c460635e023179fb53abc4 8587e78ab6bda3bc820a9f014c3be4a21ad4fcc8 c9b5f067f3e892122a4b12b0a25a8089192f3ac8]
end
with_them do
it do
expect(issue.designs.pluck(:filename)).to contain_exactly(*design_filenames)
expect(issue.design_versions.pluck(:sha)).to contain_exactly(*version_shas)
end
end
end end
describe 'restores design version associations correctly' do with_them do
let(:project_designs) { project.designs.reorder(:filename, :issue_id) } it do
let(:design) { project_designs.offset(index).first } expect(issue.designs.pluck(:filename)).to contain_exactly(*design_filenames)
expect(issue.design_versions.pluck(:sha)).to contain_exactly(*version_shas)
where(:index, :version_shas) do
0 | %w[73f871b4c8c1d65c62c460635e023179fb53abc4 c9b5f067f3e892122a4b12b0a25a8089192f3ac8]
1 | %w[73f871b4c8c1d65c62c460635e023179fb53abc4]
2 | %w[c9b5f067f3e892122a4b12b0a25a8089192f3ac8]
3 | %w[27702d08f5ee021ae938737f84e8fe7c38599e85 9358d1bac8ff300d3d2597adaa2572a20f7f8703 e1a4a501bcb42f291f84e5d04c8f927821542fb6]
4 | %w[8587e78ab6bda3bc820a9f014c3be4a21ad4fcc8]
5 | %w[27702d08f5ee021ae938737f84e8fe7c38599e85 e1a4a501bcb42f291f84e5d04c8f927821542fb6]
6 | %w[27702d08f5ee021ae938737f84e8fe7c38599e85]
end
with_them do
it do
expect(design.versions.pluck(:sha)).to contain_exactly(*version_shas)
end
end end
end end
end end
context 'when the `export_designs` feature is disabled' do describe 'restores design version associations correctly' do
before do let(:project_designs) { project.designs.reorder(:filename, :issue_id) }
stub_feature_flags(export_designs: false) let(:design) { project_designs.offset(index).first }
restored_project_json where(:index, :version_shas) do
end 0 | %w[73f871b4c8c1d65c62c460635e023179fb53abc4 c9b5f067f3e892122a4b12b0a25a8089192f3ac8]
1 | %w[73f871b4c8c1d65c62c460635e023179fb53abc4]
it_behaves_like 'restores project correctly', issues: 2 2 | %w[c9b5f067f3e892122a4b12b0a25a8089192f3ac8]
3 | %w[27702d08f5ee021ae938737f84e8fe7c38599e85 9358d1bac8ff300d3d2597adaa2572a20f7f8703 e1a4a501bcb42f291f84e5d04c8f927821542fb6]
it 'does not restore any Designs' do 4 | %w[8587e78ab6bda3bc820a9f014c3be4a21ad4fcc8]
expect(DesignManagement::Design).not_to exist 5 | %w[27702d08f5ee021ae938737f84e8fe7c38599e85 e1a4a501bcb42f291f84e5d04c8f927821542fb6]
end 6 | %w[27702d08f5ee021ae938737f84e8fe7c38599e85]
it 'does not restore any Versions' do
expect(DesignManagement::Version.exists?).to be false
end end
it 'does not restore any DesignVersions' do with_them do
expect(DesignManagement::Action.exists?).to be false it do
expect(design.versions.pluck(:sha)).to contain_exactly(*version_shas)
end
end end
end end
end end
......
...@@ -29,17 +29,5 @@ describe Gitlab::ImportExport::Importer do ...@@ -29,17 +29,5 @@ describe Gitlab::ImportExport::Importer do
importer.execute importer.execute
end end
context 'when the `export_designs` feature is disabled' do
before do
stub_feature_flags(export_designs: false)
end
it 'does not restore the design repo' do
expect(Gitlab::ImportExport::DesignRepoRestorer).not_to receive(:new)
importer.execute
end
end
end end
end end
...@@ -15,17 +15,5 @@ describe Projects::ImportExport::ExportService do ...@@ -15,17 +15,5 @@ describe Projects::ImportExport::ExportService do
service.execute service.execute
end end
context 'when the `export_designs` feature is disabled' do
before do
stub_feature_flags(export_designs: false)
end
it 'does not save the design repo' do
expect(Gitlab::ImportExport::DesignRepoSaver).not_to receive(:new)
service.execute
end
end
end end
end end
...@@ -120,10 +120,6 @@ module Gitlab ...@@ -120,10 +120,6 @@ module Gitlab
end end
end end
def remove_feature_dependent_sub_relations!(_relation_item)
# no-op
end
def project_relations def project_relations
@project_relations ||= reader.attributes_finder.find_relations_tree(:project) @project_relations ||= reader.attributes_finder.find_relations_tree(:project)
end end
...@@ -175,8 +171,6 @@ module Gitlab ...@@ -175,8 +171,6 @@ module Gitlab
# Avoid keeping a possible heavy object in memory once we are done with it # Avoid keeping a possible heavy object in memory once we are done with it
while relation_item = tree_array.shift while relation_item = tree_array.shift
remove_feature_dependent_sub_relations!(relation_item)
# The transaction at this level is less speedy than one single transaction # The transaction at this level is less speedy than one single transaction
# But we can't have it in the upper level or GC won't get rid of the AR objects # But we can't have it in the upper level or GC won't get rid of the AR objects
# after we save the batch. # after we save the batch.
...@@ -241,5 +235,3 @@ module Gitlab ...@@ -241,5 +235,3 @@ module Gitlab
end end
end end
end end
Gitlab::ImportExport::ProjectTreeRestorer.prepend_if_ee('::EE::Gitlab::ImportExport::ProjectTreeRestorer')
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