diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-22 12:13:25 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-23 13:36:38 +0200 |
commit | 22ef4ba3a4be66296e5ee9231b4eb39e172c0f1f (patch) | |
tree | d59cb5328fffd5f0161444893b3429ae94e543cd /lib/tasks | |
parent | d8d2b73b9f17e5af9aeccb1e9ba40045486651b5 (diff) | |
download | gitlab-ce-22ef4ba3a4be66296e5ee9231b4eb39e172c0f1f.tar.gz |
Migrate creation of nested groups into a service
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/import.rake | 18 |
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) |