Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bulk_imports/projects/transformers/project_attributes_transformer.rb')
-rw-r--r--lib/bulk_imports/projects/transformers/project_attributes_transformer.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb b/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb
index 205c3185f72..c5ed9d42e44 100644
--- a/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb
+++ b/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb
@@ -4,21 +4,23 @@ module BulkImports
module Projects
module Transformers
class ProjectAttributesTransformer
+ include BulkImports::VisibilityLevel
+
PROJECT_IMPORT_TYPE = 'gitlab_project_migration'
def transform(context, data)
project = {}
entity = context.entity
- visibility = data.delete('visibility')
+ namespace = Namespace.find_by_full_path(entity.destination_namespace)
project[:name] = entity.destination_slug
project[:path] = entity.destination_slug.parameterize
project[:created_at] = data['created_at']
project[:import_type] = PROJECT_IMPORT_TYPE
- project[:visibility_level] = Gitlab::VisibilityLevel.string_options[visibility] if visibility.present?
- project[:namespace_id] = Namespace.find_by_full_path(entity.destination_namespace)&.id if entity.destination_namespace.present?
+ project[:visibility_level] = visibility_level(entity, namespace, data['visibility'])
+ project[:namespace_id] = namespace.id if namespace
- project
+ project.with_indifferent_access
end
end
end