2022-08-13 15:12:31 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module WebHooks
|
|
|
|
module WebHooksHelper
|
|
|
|
def show_project_hook_failed_callout?(project:)
|
2022-10-11 01:57:18 +05:30
|
|
|
return false if project_hook_page?
|
2022-08-13 15:12:31 +05:30
|
|
|
return false unless current_user
|
|
|
|
return false unless Ability.allowed?(current_user, :read_web_hooks, project)
|
|
|
|
|
|
|
|
# Assumes include of Users::CalloutsHelper
|
|
|
|
return false if web_hook_disabled_dismissed?(project)
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
project.fetch_web_hook_failure
|
2022-08-13 15:12:31 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
def project_hook_page?
|
|
|
|
current_controller?('projects/hooks') || current_controller?('projects/hook_logs')
|
|
|
|
end
|
2022-08-13 15:12:31 +05:30
|
|
|
end
|
|
|
|
end
|