diff options
author | Brandon Williams <brandon@amazee.io> | 2019-08-29 02:27:18 +0300 |
---|---|---|
committer | Brandon Williams <brandon@amazee.io> | 2019-09-03 02:35:36 +0300 |
commit | 2bd4d580d17e91605b4f350eafb2e9a50d6181c7 (patch) | |
tree | 65b26cd311a61fd7c2854717cd916e0787c1fd59 /app | |
parent | 5c8545edf1b78ef4e93e7fd4207102aca02a85c0 (diff) |
Add system hooks for project/group membership updates
When updating group and project members, new system hooks
`user_update_for_group` and `user_update_for_team` will be executed.
Fixes https://gitlab.com/gitlab-org/gitlab-ee/issues/12252
Diffstat (limited to 'app')
-rw-r--r-- | app/models/member.rb | 2 | ||||
-rw-r--r-- | app/services/system_hooks_service.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index dbae1076670..6457fe9ef0c 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -399,7 +399,7 @@ class Member < ApplicationRecord end def post_update_hook - # override in sub class + system_hook_service.execute_hooks_for(self, :update) end def post_destroy_hook diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index 858e04f43b2..34260d12a62 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -74,9 +74,11 @@ class SystemHooksService when ProjectMember return "user_add_to_team" if event == :create return "user_remove_from_team" if event == :destroy + return "user_update_for_team" if event == :update when GroupMember return 'user_add_to_group' if event == :create return 'user_remove_from_group' if event == :destroy + return 'user_update_for_group' if event == :update else "#{model.class.name.downcase}_#{event}" end |