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

onboarding_progress_service.rb « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6d44c0a61ea357517c3198d3da946a11ce4d4a1a (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
25
26
27
28
29
30
31
# frozen_string_literal: true

class OnboardingProgressService
  class Async
    attr_reader :namespace_id

    def initialize(namespace_id)
      @namespace_id = namespace_id
    end

    def execute(action:)
      return unless OnboardingProgress.not_completed?(namespace_id, action)

      Namespaces::OnboardingProgressWorker.perform_async(namespace_id, action)
    end
  end

  def self.async(namespace_id)
    Async.new(namespace_id)
  end

  def initialize(namespace)
    @namespace = namespace&.root_ancestor
  end

  def execute(action:)
    return unless @namespace

    OnboardingProgress.register(@namespace, action)
  end
end