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/services/jira_connect_installations')
-rw-r--r--app/services/jira_connect_installations/destroy_service.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/jira_connect_installations/destroy_service.rb b/app/services/jira_connect_installations/destroy_service.rb
new file mode 100644
index 00000000000..cfe58575dcf
--- /dev/null
+++ b/app/services/jira_connect_installations/destroy_service.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module JiraConnectInstallations
+ class DestroyService
+ def self.execute(installation, jira_connect_base_path, jira_connect_uninstalled_event_path)
+ new(installation, jira_connect_base_path, jira_connect_uninstalled_event_path).execute
+ end
+
+ def initialize(installation, jira_connect_base_path, jira_connect_uninstalled_event_path)
+ @installation = installation
+ @jira_connect_base_path = jira_connect_base_path
+ @jira_connect_uninstalled_event_path = jira_connect_uninstalled_event_path
+ end
+
+ def execute
+ if @installation.instance_url.present?
+ JiraConnect::ForwardEventWorker.perform_async(@installation.id, @jira_connect_base_path, @jira_connect_uninstalled_event_path)
+ return true
+ end
+
+ @installation.destroy
+ end
+ end
+end