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

hook_log_actions.rb « web_hooks « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 321cee5a452a7badb74537a0ad349067115b235f (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
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

module WebHooks
  module HookLogActions
    extend ActiveSupport::Concern
    include HookExecutionNotice

    included do
      before_action :hook, only: [:show, :retry]
      before_action :hook_log, only: [:show, :retry]

      respond_to :html

      feature_category :webhooks
      urgency :low, [:retry]
    end

    def show
      hide_search_settings
    end

    def retry
      execute_hook
      redirect_to after_retry_redirect_path
    end

    private

    # rubocop:disable Gitlab/ModuleWithInstanceVariables
    def hook_log
      @hook_log ||= hook.web_hook_logs.find(params[:id])
    end
    # rubocop:enable Gitlab/ModuleWithInstanceVariables

    def execute_hook
      result = hook.execute(hook_log.request_data, hook_log.trigger)
      set_hook_execution_notice(result)
    end

    def hide_search_settings
      @hide_search_settings ||= true
    end
  end
end