Commit 91d357a6 authored by Illya Klymov's avatar Illya Klymov

Address reviewer comments

parent 0f385b5c
......@@ -64,10 +64,9 @@ export default {
});
const existingProjects = [...newImportedProjects, ...state.repositories];
const existingProjectNames = new Set(existingProjects.map((p) => p.importSource.fullName));
const newProjects = repositories.providerRepos
.filter(
(project) => !existingProjects.find((p) => p.importSource.fullName === project.fullName),
)
.filter((project) => !existingProjectNames.has(project.fullName))
.map((project) => ({
importSource: project,
importedProject: null,
......
......@@ -74,12 +74,10 @@ class Import::FogbugzController < Import::BaseController
protected
# rubocop: disable CodeReuse/ActiveRecord
override :importable_repos
def importable_repos
client.repos
end
# rubocop: enable CodeReuse/ActiveRecord
override :incompatible_repos
def incompatible_repos
......
......@@ -41,7 +41,7 @@ class Import::ManifestController < Import::BaseController
end
def create
repository = repositories.find do |project|
repository = importable_repos.find do |project|
project[:id] == params[:repo_id].to_i
end
......@@ -56,14 +56,10 @@ class Import::ManifestController < Import::BaseController
protected
# rubocop: disable CodeReuse/ActiveRecord
override :importable_repos
def importable_repos
already_added_projects_names = already_added_projects.pluck(:import_url)
repositories.reject { |repo| already_added_projects_names.include?(repo[:url]) }
@importable_repos ||= manifest_import_metadata.repositories
end
# rubocop: enable CodeReuse/ActiveRecord
override :incompatible_repos
def incompatible_repos
......@@ -88,7 +84,7 @@ class Import::ManifestController < Import::BaseController
private
def ensure_import_vars
unless group && repositories.present?
unless group && importable_repos.present?
redirect_to(new_import_manifest_path)
end
end
......@@ -103,10 +99,6 @@ class Import::ManifestController < Import::BaseController
@manifest_import_status ||= Gitlab::ManifestImport::Metadata.new(current_user, fallback: session)
end
def repositories
@repositories ||= manifest_import_metadata.repositories
end
def find_jobs
find_already_added_projects.to_json(only: [:id], methods: [:import_status])
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment