Class: SystemHooksService

Inherits:
Object
  • Object
show all
Defined in:
app/services/system_hooks_service.rb

Instance Method Summary collapse

Instance Method Details

#execute_hooks(data, hooks_scope = :all) ⇒ Object


12
13
14
15
16
17
18
# File 'app/services/system_hooks_service.rb', line 12

def execute_hooks(data, hooks_scope = :all)
  SystemHook.hooks_for(hooks_scope).find_each do |hook|
    hook.async_execute(data, 'system_hooks')
  end

  Gitlab::FileHook.execute_all_async(data)
end

#execute_hooks_for(model, event) ⇒ Object


4
5
6
7
8
9
10
# File 'app/services/system_hooks_service.rb', line 4

def execute_hooks_for(model, event)
  data = build_event_data(model, event)

  model.run_after_commit_or_now do
    SystemHooksService.new.execute_hooks(data)
  end
end