be42c05054
Enables frozen string for the following: * app/controllers/dashboard/**/*.rb * app/controllers/explore/**/*.rb * app/controllers/google_api/**/*.rb * app/controllers/groups/**/*.rb * app/controllers/import/**/*.rb * app/controllers/instance_statistics/**/*.rb * app/controllers/ldap/**/*.rb * app/controllers/oauth/**/*.rb * app/controllers/profiles/**/*.rb Partially addresses #47424.
38 lines
1 KiB
Ruby
38 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class Import::BaseController < ApplicationController
|
|
private
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
|
def find_already_added_projects(import_type)
|
|
current_user.created_projects.where(import_type: import_type).includes(:import_state)
|
|
end
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
|
def find_jobs(import_type)
|
|
current_user.created_projects
|
|
.includes(:import_state)
|
|
.where(import_type: import_type)
|
|
.to_json(only: [:id], methods: [:import_status])
|
|
end
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
|
|
def find_or_create_namespace(names, owner)
|
|
names = params[:target_namespace].presence || names
|
|
|
|
return current_user.namespace if names == owner
|
|
|
|
group = Groups::NestedCreateService.new(current_user, group_path: names).execute
|
|
|
|
group.errors.any? ? current_user.namespace : group
|
|
rescue => e
|
|
Gitlab::AppLogger.error(e)
|
|
|
|
current_user.namespace
|
|
end
|
|
|
|
def project_save_error(project)
|
|
project.errors.full_messages.join(', ')
|
|
end
|
|
end
|