2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
class ProjectHook < WebHook
|
2018-03-17 18:26:18 +05:30
|
|
|
include TriggerableHooks
|
2020-01-01 13:55:28 +05:30
|
|
|
include Presentable
|
2020-05-24 23:13:21 +05:30
|
|
|
include Limitable
|
2021-06-08 01:23:25 +05:30
|
|
|
extend ::Gitlab::Utils::Override
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
self.limit_scope = :project
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
triggerable_hooks [
|
|
|
|
:push_hooks,
|
|
|
|
:tag_push_hooks,
|
|
|
|
:issue_hooks,
|
|
|
|
:confidential_issue_hooks,
|
|
|
|
:note_hooks,
|
2018-04-05 14:03:07 +05:30
|
|
|
:confidential_note_hooks,
|
2018-03-17 18:26:18 +05:30
|
|
|
:merge_request_hooks,
|
|
|
|
:job_hooks,
|
|
|
|
:pipeline_hooks,
|
2020-10-24 23:57:45 +05:30
|
|
|
:wiki_page_hooks,
|
2021-01-29 00:20:46 +05:30
|
|
|
:deployment_hooks,
|
|
|
|
:feature_flag_hooks,
|
|
|
|
:release_hooks
|
2018-03-17 18:26:18 +05:30
|
|
|
]
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
belongs_to :project
|
|
|
|
validates :project, presence: true
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
def pluralized_name
|
2020-04-08 14:13:33 +05:30
|
|
|
_('Webhooks')
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
def web_hooks_disable_failed?
|
|
|
|
Feature.enabled?(:web_hooks_disable_failed, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
override :rate_limit
|
|
|
|
def rate_limit
|
|
|
|
project.actual_limits.limit_for(:web_hook_calls)
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
ProjectHook.prepend_mod_with('ProjectHook')
|