diff options
Diffstat (limited to 'lib/gitlab/bitbucket_import/importer.rb')
-rw-r--r-- | lib/gitlab/bitbucket_import/importer.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb index 519a109c0c8..b6a0b122cdb 100644 --- a/lib/gitlab/bitbucket_import/importer.rb +++ b/lib/gitlab/bitbucket_import/importer.rb @@ -24,21 +24,21 @@ module Gitlab private - def gitlab_user_id(project, user) - if user.uuid - user = find_user_by_uuid(user.uuid) + def gitlab_user_id(project, username) + if username + user = find_user(username) (user && user.id) || project.creator_id else project.creator_id end end - def find_user_by_uuid(uuid) - User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", uuid) + def find_user(username) + User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", username) end - def existing_gitlab_user?(user) - user.uuid && find_user_by_uuid(user.uuid) + def existing_gitlab_user?(username) + username && find_user(username) end def repo @@ -52,7 +52,7 @@ module Gitlab client.issues(repo).each do |issue| description = '' - description += @formatter.author_line(issue.author.username) unless existing_gitlab_user?(issue.author) + description += @formatter.author_line(issue.author) unless existing_gitlab_user?(issue.author) description += issue.description label_name = issue.kind @@ -79,7 +79,7 @@ module Gitlab next unless comment.note.present? note = '' - note += @formatter.author_line(comment.author.username) unless existing_gitlab_user?(comment.author) + note += @formatter.author_line(comment.author) unless existing_gitlab_user?(comment.author) note += comment.note issue.notes.create!( @@ -108,7 +108,7 @@ module Gitlab pull_requests.each do |pull_request| begin description = '' - description += @formatter.author_line(pull_request.author.username) unless existing_gitlab_user?(pull_request.author) + description += @formatter.author_line(pull_request.author) unless existing_gitlab_user?(pull_request.author) description += pull_request.description merge_request = project.merge_requests.create( |