diff options
Diffstat (limited to 'lib/gitlab/phabricator_import/user_finder.rb')
-rw-r--r-- | lib/gitlab/phabricator_import/user_finder.rb | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/lib/gitlab/phabricator_import/user_finder.rb b/lib/gitlab/phabricator_import/user_finder.rb deleted file mode 100644 index c6058d12527..00000000000 --- a/lib/gitlab/phabricator_import/user_finder.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module PhabricatorImport - class UserFinder - def initialize(project, phids) - @project = project - @phids = phids - @loaded_phids = Set.new - end - - def find(phid) - found_user = object_map.get_gitlab_model(phid) do - find_user_for_phid(phid) - end - - loaded_phids << phid - - found_user - end - - private - - attr_reader :project, :phids, :loaded_phids - - def object_map - @object_map ||= Gitlab::PhabricatorImport::Cache::Map.new(project) - end - - def find_user_for_phid(phid) - phabricator_user = phabricator_users.find { |u| u.phabricator_id == phid } - return unless phabricator_user - - project.authorized_users.find_by_username(phabricator_user.username) - end - - def phabricator_users - @user_responses ||= client.users(users_to_request).flat_map(&:users) - end - - def users_to_request - phids - loaded_phids.to_a - end - - def client - @client ||= - Gitlab::PhabricatorImport::Conduit::User - .new(phabricator_url: project.import_data.data['phabricator_url'], - api_token: project.import_data.credentials[:api_token]) - end - end - end -end |