Commit 88d9a031 authored by serenafang's avatar serenafang

Start adding backend for group member hook

Use group member data builder
parent f55774d4
...@@ -15,7 +15,8 @@ module TriggerableHooks ...@@ -15,7 +15,8 @@ module TriggerableHooks
wiki_page_hooks: :wiki_page_events, wiki_page_hooks: :wiki_page_events,
deployment_hooks: :deployment_events, deployment_hooks: :deployment_events,
feature_flag_hooks: :feature_flag_events, feature_flag_hooks: :feature_flag_events,
release_hooks: :releases_events release_hooks: :releases_events,
member_hooks: :member_events
}.freeze }.freeze
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
...@@ -63,6 +63,8 @@ class GroupMember < Member ...@@ -63,6 +63,8 @@ class GroupMember < Member
def post_create_hook def post_create_hook
run_after_commit_or_now { notification_service.new_group_member(self) } run_after_commit_or_now { notification_service.new_group_member(self) }
add_group_member_data = Gitlab::HookData::GroupMemberBuilder.new(self).build(create)
group.execute_services(add_group_member_data, :member_hooks)
super super
end end
......
...@@ -86,6 +86,7 @@ class Service < ApplicationRecord ...@@ -86,6 +86,7 @@ class Service < ApplicationRecord
scope :pipeline_hooks, -> { where(pipeline_events: true, active: true) } scope :pipeline_hooks, -> { where(pipeline_events: true, active: true) }
scope :wiki_page_hooks, -> { where(wiki_page_events: true, active: true) } scope :wiki_page_hooks, -> { where(wiki_page_events: true, active: true) }
scope :deployment_hooks, -> { where(deployment_events: true, active: true) } scope :deployment_hooks, -> { where(deployment_events: true, active: true) }
scope :member_hooks, -> { where(member_events: true, active: true) }
scope :alert_hooks, -> { where(alert_events: true, active: true) } scope :alert_hooks, -> { where(alert_events: true, active: true) }
scope :deployment, -> { where(category: 'deployment') } scope :deployment, -> { where(category: 'deployment') }
......
...@@ -20,7 +20,8 @@ class GroupHook < WebHook ...@@ -20,7 +20,8 @@ class GroupHook < WebHook
:pipeline_hooks, :pipeline_hooks,
:wiki_page_hooks, :wiki_page_hooks,
:deployment_hooks, :deployment_hooks,
:release_hooks :release_hooks,
:member_hooks
] ]
belongs_to :group belongs_to :group
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment