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

web_hooks_helper.rb « web_hooks « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 514db6ba8a2ff2ff19bc643be9cba9e66aa510d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module WebHooks
  module WebHooksHelper
    def show_project_hook_failed_callout?(project:)
      return false if project_hook_page?
      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)

      project.fetch_web_hook_failure
    end

    private

    def project_hook_page?
      current_controller?('projects/hooks') || current_controller?('projects/hook_logs')
    end
  end
end