diff options
author | Boyan Tabakov <boyan.tabakov@futurice.com> | 2014-08-21 13:53:32 +0300 |
---|---|---|
committer | Boyan Tabakov <boyan.tabakov@futurice.com> | 2015-01-27 09:25:28 +0200 |
commit | 93bc2d5202e5802bd31419d05232b62355516a53 (patch) | |
tree | a1b2f38faa6470b8df2f0047115a22fbe8361f57 /app/models/group.rb | |
parent | a4dad7085850aa62134ed23b90f3a045c3569663 (diff) | |
download | gitlab-ce-93bc2d5202e5802bd31419d05232b62355516a53.tar.gz |
Added support for firing system hooks on group create/destroy and adding/removing users to group.
Added tests and updated docs. Also adding 'user_id' field in the hooks for adding/removing user from team.
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 733afa2fc07..e098dfb3cdf 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -25,6 +25,9 @@ class Group < Namespace mount_uploader :avatar, AttachmentUploader + after_create :post_create_hook + after_destroy :post_destroy_hook + def human_name name end @@ -74,6 +77,18 @@ class Group < Namespace projects.public_only.any? end + def post_create_hook + system_hook_service.execute_hooks_for(self, :create) + end + + def post_destroy_hook + system_hook_service.execute_hooks_for(self, :destroy) + end + + def system_hook_service + SystemHooksService.new + end + class << self def search(query) where("LOWER(namespaces.name) LIKE :query", query: "%#{query.downcase}%") |