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

destroy_service.rb « jira_connect_installations « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cfe58575dcf330621bc17f9d54f3bb884389108d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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