summaryrefslogtreecommitdiff
path: root/app/controllers/import/bitbucket_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/import/bitbucket_controller.rb')
-rw-r--r--app/controllers/import/bitbucket_controller.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb
index 944c73d139a..94e213b8743 100644
--- a/app/controllers/import/bitbucket_controller.rb
+++ b/app/controllers/import/bitbucket_controller.rb
@@ -35,15 +35,10 @@ class Import::BitbucketController < Import::BaseController
end
def create
- @repo_id = params[:repo_id] || ""
- repo = client.project(@repo_id.gsub("___", "/"))
- @project_name = repo["slug"]
-
- repo_owner = repo["owner"]
- repo_owner = current_user.username if repo_owner == client.user["user"]["username"]
- @target_namespace = params[:new_namespace].presence || repo_owner
-
- namespace = get_or_create_namespace || (render and return)
+ @repo_id = params[:repo_id].to_s
+ repo = client.project(@repo_id.gsub('___', '/'))
+ @project_name = repo['slug']
+ namespace = find_or_create_namespace(repo['owner'], client.user['user']['username']) || (render and return)
unless Gitlab::BitbucketImport::KeyAdder.new(repo, current_user, access_params).execute
@access_denied = true