diff options
author | Douwe Maan <douwe@gitlab.com> | 2019-01-07 23:15:53 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-01-07 23:15:53 +0000 |
commit | cfa7108210490704a8110ee97a26de9ae4d9adaf (patch) | |
tree | 4c66dc55df99405b8aba8ed9fa0e3d1fd34eb30e /app/workers | |
parent | 420fb032fc9760395c96bafd3f6600950c2125f4 (diff) | |
parent | f54290de751e365be0928c66bb75fd106bb7aa88 (diff) | |
download | gitlab-ce-cfa7108210490704a8110ee97a26de9ae4d9adaf.tar.gz |
Merge branch '49231-import-issues-csv' into 'master'
Import issues from CSV
Closes #49231
See merge request gitlab-org/gitlab-ce!23532
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 1 | ||||
-rw-r--r-- | app/workers/import_issues_csv_worker.rb | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index d3cf21db335..223ddc80c88 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -140,3 +140,4 @@ - detect_repository_languages - repository_cleanup - delete_stored_files +- import_issues_csv diff --git a/app/workers/import_issues_csv_worker.rb b/app/workers/import_issues_csv_worker.rb new file mode 100644 index 00000000000..d44fdfec8ae --- /dev/null +++ b/app/workers/import_issues_csv_worker.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class ImportIssuesCsvWorker + include ApplicationWorker + + sidekiq_retries_exhausted do |job| + Upload.find(job['args'][2]).destroy + end + + def perform(current_user_id, project_id, upload_id) + @user = User.find(current_user_id) + @project = Project.find(project_id) + @upload = Upload.find(upload_id) + + importer = Issues::ImportCsvService.new(@user, @project, @upload.build_uploader) + importer.execute + + @upload.destroy + end +end |