2018-08-03 13:22:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2012-07-12 08:36:33 -04:00
|
|
|
class SystemHook < WebHook
|
2017-12-04 05:18:54 -05:00
|
|
|
include TriggerableHooks
|
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
|
|
|
:repository_update_hooks,
|
|
|
|
:push_hooks,
|
|
|
|
:tag_push_hooks,
|
|
|
|
:merge_request_hooks
|
|
|
|
]
|
2017-05-02 22:36:13 -04:00
|
|
|
|
2017-05-05 08:11:28 -04:00
|
|
|
default_value_for :push_events, false
|
|
|
|
default_value_for :repository_update_events, true
|
2017-09-13 11:17:34 -04:00
|
|
|
default_value_for :merge_requests_events, false
|
2018-06-01 07:43:53 -04:00
|
|
|
|
2019-07-30 06:53:23 -04:00
|
|
|
validates :url, system_hook_url: true
|
2019-07-26 06:21:52 -04:00
|
|
|
|
2018-06-01 07:43:53 -04:00
|
|
|
# Allow urls pointing localhost and the local network
|
|
|
|
def allow_local_requests?
|
2019-07-26 06:21:52 -04:00
|
|
|
Gitlab::CurrentSettings.allow_local_requests_from_system_hooks?
|
2018-06-01 07:43:53 -04:00
|
|
|
end
|
2019-12-16 04:08:10 -05:00
|
|
|
|
|
|
|
def pluralized_name
|
|
|
|
_('System Hooks')
|
|
|
|
end
|
|
|
|
|
|
|
|
def help_path
|
|
|
|
'system_hooks/system_hooks'
|
|
|
|
end
|
2012-07-12 08:36:33 -04:00
|
|
|
end
|