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
|
|
|
|
|
|
|
default_value_for :push_events, false
|
|
|
|
default_value_for :repository_update_events, true
|
2018-03-17 18:26:18 +05:30
|
|
|
default_value_for :merge_requests_events, 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
|
|
|
|
'system_hooks/system_hooks'
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|