debian-mirror-gitlab/app/controllers/import/base_controller.rb
2018-03-17 18:26:18 +05:30

17 lines
443 B
Ruby

class Import::BaseController < ApplicationController
private
def find_or_create_namespace(names, owner)
names = params[:target_namespace].presence || names
return current_user.namespace if names == owner
group = Groups::NestedCreateService.new(current_user, group_path: names).execute
group.errors.any? ? current_user.namespace : group
rescue => e
Gitlab::AppLogger.error(e)
current_user.namespace
end
end