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

hook_service.rb « feature_flags « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6f77a70bd094d1277c512910a7c316a2985b72f9 (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
# frozen_string_literal: true

module FeatureFlags
  class HookService
    HOOK_NAME = :feature_flag_hooks

    def initialize(feature_flag, current_user)
      @feature_flag = feature_flag
      @current_user = current_user
    end

    def execute
      project.execute_hooks(hook_data, HOOK_NAME)
    end

    private

    attr_reader :feature_flag, :current_user

    def project
      @project ||= feature_flag.project
    end

    def hook_data
      Gitlab::DataBuilder::FeatureFlag.build(feature_flag, current_user)
    end
  end
end