2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
class SystemHook < WebHook
|
2018-03-17 18:26:18 +05:30
|
|
|
include TriggerableHooks
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
triggerable_hooks [
|
|
|
|
:repository_update_hooks,
|
|
|
|
:push_hooks,
|
|
|
|
:tag_push_hooks,
|
|
|
|
:merge_request_hooks
|
|
|
|
]
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
attribute :push_events, default: false
|
|
|
|
attribute :repository_update_events, default: true
|
|
|
|
attribute :merge_requests_events, default: false
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
validates :url, system_hook_url: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
# Allow urls pointing localhost and the local network
|
|
|
|
def allow_local_requests?
|
2019-10-12 21:52:04 +05:30
|
|
|
Gitlab::CurrentSettings.allow_local_requests_from_system_hooks?
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
def pluralized_name
|
|
|
|
_('System Hooks')
|
|
|
|
end
|
|
|
|
|
|
|
|
def help_path
|
2022-08-13 15:12:31 +05:30
|
|
|
'administration/system_hooks'
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|