BB importer: address review comment
This commit is contained in:
parent
3b4e81eed5
commit
b0501c34c4
|
@ -20,7 +20,7 @@ It takes just a few steps to import your existing Bitbucket projects to GitLab.
|
|||
|
||||
![Import projects](bitbucket_importer/bitbucket_import_select_project.png)
|
||||
|
||||
A new GitLab project will be created with your imported data. Keep in mind that if you want to Bitbucket users
|
||||
A new GitLab project will be created with your imported data. Keep in mind that if you want Bitbucket users
|
||||
to be linked to GitLab user you have to have all of them in GitLab in advance. They will be matched by their BitBucket username.
|
||||
|
||||
### Note
|
||||
|
|
|
@ -28,6 +28,7 @@ module Gitlab
|
|||
|
||||
def handle_errors
|
||||
return unless errors.any?
|
||||
|
||||
project.update_column(:import_error, {
|
||||
message: 'The remote data could not be fully imported.',
|
||||
errors: errors
|
||||
|
@ -35,15 +36,12 @@ module Gitlab
|
|||
end
|
||||
|
||||
def gitlab_user_id(project, username)
|
||||
if username
|
||||
user = find_user(username)
|
||||
(user && user.id) || project.creator_id
|
||||
else
|
||||
project.creator_id
|
||||
end
|
||||
user = find_user(username)
|
||||
user.try(:id) || project.creator_id
|
||||
end
|
||||
|
||||
def find_user(username)
|
||||
return nil unless username
|
||||
User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", username)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue