debian-mirror-gitlab/app/controllers/concerns/web_hooks/hook_execution_notice.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
573 B
Ruby
Raw Normal View History

2022-10-11 01:57:18 +05:30
# frozen_string_literal: true
module WebHooks
module HookExecutionNotice
private
def set_hook_execution_notice(result)
2023-01-13 00:05:48 +05:30
http_status = result.payload[:http_status]
2022-10-11 01:57:18 +05:30
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