2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Issues
|
2021-01-29 00:20:46 +05:30
|
|
|
class ImportCsvService < Issuable::ImportCsv::BaseService
|
2019-02-15 15:39:39 +05:30
|
|
|
def execute
|
2021-01-29 00:20:46 +05:30
|
|
|
record_import_attempt
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
super
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def email_results_to_user
|
2023-04-23 21:23:45 +05:30
|
|
|
Notify.import_issues_csv_email(user.id, project.id, results).deliver_later
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
private
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
def create_object(attributes)
|
2022-11-25 23:54:43 +05:30
|
|
|
super[:issue]
|
|
|
|
end
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
def create_object_class
|
2021-01-29 00:20:46 +05:30
|
|
|
Issues::CreateService
|
|
|
|
end
|
|
|
|
|
|
|
|
def record_import_attempt
|
2023-04-23 21:23:45 +05:30
|
|
|
Issues::CsvImport.create!(user: user, project: project)
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|