summaryrefslogtreecommitdiff
path: root/app/services/system_hooks_service.rb
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-04-15 08:08:22 -0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-04-19 11:00:30 +0200
commitee1090e2b2bc7b3762f6e2775f3fd15e92ae212b (patch)
tree9df863f27349ca2a95d0e6f16d99b85d4806d992 /app/services/system_hooks_service.rb
parent53a1d705fe536ad373faa77ba1ef5196ff49a98b (diff)
downloadgitlab-ce-ee1090e2b2bc7b3762f6e2775f3fd15e92ae212b.tar.gz
Added System Hooks for push and tag_push
Code is based on Project Webhooks, removing deprecations and without commits listing.
Diffstat (limited to 'app/services/system_hooks_service.rb')
-rw-r--r--app/services/system_hooks_service.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index f0615ec7420..e43b5b51e5b 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -3,17 +3,13 @@ class SystemHooksService
execute_hooks(build_event_data(model, event))
end
- private
-
- def execute_hooks(data)
- SystemHook.all.each do |sh|
- async_execute_hook(sh, data, 'system_hooks')
+ def execute_hooks(data, hooks_scope = :all)
+ SystemHook.send(hooks_scope).each do |hook|
+ hook.async_execute(data, 'system_hooks')
end
end
- def async_execute_hook(hook, data, hook_name)
- Sidekiq::Client.enqueue(SystemHookWorker, hook.id, data, hook_name)
- end
+ private
def build_event_data(model, event)
data = {