Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/concerns/gitlab/jira_import/import_worker.rb')
-rw-r--r--app/workers/concerns/gitlab/jira_import/import_worker.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/workers/concerns/gitlab/jira_import/import_worker.rb b/app/workers/concerns/gitlab/jira_import/import_worker.rb
new file mode 100644
index 00000000000..7cc650bfc29
--- /dev/null
+++ b/app/workers/concerns/gitlab/jira_import/import_worker.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module JiraImport
+ module ImportWorker
+ extend ActiveSupport::Concern
+
+ included do
+ include ApplicationWorker
+ include Gitlab::JiraImport::QueueOptions
+ end
+
+ def perform(project_id)
+ project = Project.find_by(id: project_id) # rubocop: disable CodeReuse/ActiveRecord
+
+ return unless can_import?(project)
+
+ import(project)
+ end
+
+ private
+
+ def import(project)
+ raise NotImplementedError
+ end
+
+ def can_import?(project)
+ return false unless project
+ return false if Feature.disabled?(:jira_issue_import, project)
+
+ project.import_state.started?
+ end
+ end
+ end
+end