gitlab-org--gitlab-foss/app/models/hooks/project_hook.rb

58 lines
1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2012-11-19 13:24:05 -05:00
class ProjectHook < WebHook
2017-12-04 05:18:54 -05:00
include TriggerableHooks
include Presentable
include Limitable
extend ::Gitlab::Utils::Override
self.limit_scope = :project
2017-07-20 11:12:06 -04:00
2017-12-04 09:45:47 -05:00
triggerable_hooks [
2017-12-04 05:18:54 -05:00
:push_hooks,
:tag_push_hooks,
:issue_hooks,
:confidential_issue_hooks,
:note_hooks,
:confidential_note_hooks,
2017-12-04 05:18:54 -05:00
:merge_request_hooks,
:job_hooks,
:pipeline_hooks,
:wiki_page_hooks,
:deployment_hooks,
:feature_flag_hooks,
:release_hooks
2017-12-04 05:18:54 -05:00
]
2017-07-20 11:12:06 -04:00
belongs_to :project
validates :project, presence: true
def pluralized_name
_('Webhooks')
end
override :rate_limit
def rate_limit
project.actual_limits.limit_for(:web_hook_calls)
end
override :application_context
def application_context
super.merge(project: project)
end
override :parent
def parent
project
end
private
override :web_hooks_disable_failed?
def web_hooks_disable_failed?
Feature.enabled?(:web_hooks_disable_failed, project)
end
2012-11-19 13:24:05 -05:00
end
ProjectHook.prepend_mod_with('ProjectHook')