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

hook_execution_notice.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: d651313b30d11b3a569c3984db6e7076458a4512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module WebHooks
  module HookExecutionNotice
    private

    def set_hook_execution_notice(result)
      http_status = result[:http_status]
      message = result[:message]

      if http_status && http_status >= 200 && http_status < 400
        flash[:notice] = "Hook executed successfully: HTTP #{http_status}"
      elsif http_status
        flash[:alert] = "Hook executed successfully but returned HTTP #{http_status} #{message}"
      else
        flash[:alert] = "Hook execution failed: #{message}"
      end
    end
  end
end