diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-14 21:07:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-14 21:07:46 +0300 |
commit | fbf2955cfc9ffc319d57960a0b0df1ee1b5fd05f (patch) | |
tree | 6964ec0aaac3d432a4795878e87d78566f7bf719 /app/models/projects | |
parent | 739467f1fa4d5d4042b47ff6637a567d1ad6a4a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/projects')
-rw-r--r-- | app/models/projects/triggered_hooks.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/models/projects/triggered_hooks.rb b/app/models/projects/triggered_hooks.rb new file mode 100644 index 00000000000..e3aa3d106b7 --- /dev/null +++ b/app/models/projects/triggered_hooks.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Projects + class TriggeredHooks + def initialize(scope, data) + @scope = scope + @data = data + @relations = [] + end + + def add_hooks(relation) + @relations << relation + self + end + + def execute + # Assumes that the relations implement TriggerableHooks + @relations.each do |hooks| + hooks.hooks_for(@scope).select_active(@scope, @data).each do |hook| + hook.async_execute(@data, @scope.to_s) + end + end + end + end +end |