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:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-08-22 13:13:25 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-08-23 14:36:38 +0300
commit22ef4ba3a4be66296e5ee9231b4eb39e172c0f1f (patch)
treed59cb5328fffd5f0161444893b3429ae94e543cd /lib/tasks/import.rake
parentd8d2b73b9f17e5af9aeccb1e9ba40045486651b5 (diff)
Migrate creation of nested groups into a service
Diffstat (limited to 'lib/tasks/import.rake')
-rw-r--r--lib/tasks/import.rake18
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 96b8f59242c..1206302cb76 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -72,23 +72,7 @@ class GithubImport
return @current_user.namespace if names == @current_user.namespace_path
return @current_user.namespace unless @current_user.can_create_group?
- full_path_namespace = Namespace.find_by_full_path(names)
-
- return full_path_namespace if full_path_namespace
-
- names.split('/').inject(nil) do |parent, name|
- begin
- namespace = Group.create!(name: name,
- path: name,
- owner: @current_user,
- parent: parent)
- namespace.add_owner(@current_user)
-
- namespace
- rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid
- Namespace.where(parent: parent).find_by_path_or_name(name)
- end
- end
+ Groups::NestedCreateService.new(@current_user, group_path: names).execute
end
def full_path_namespace(names)