diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-01-02 15:06:44 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-02 15:06:44 +0000 |
commit | 2665aea6275cc82888ed3e3ab3dbe384028d663c (patch) | |
tree | c293f8e3033667aa992b53f38d2e135093529242 /app/services | |
parent | 3f44c4cedbbd9b72fdf28e83caaec345934e1d8d (diff) | |
download | gitlab-ce-2665aea6275cc82888ed3e3ab3dbe384028d663c.tar.gz |
Fix user membership destroy relation
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/users/destroy_service.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/services/users/destroy_service.rb b/app/services/users/destroy_service.rb index 8e20de8dfa5..00db8a2c434 100644 --- a/app/services/users/destroy_service.rb +++ b/app/services/users/destroy_service.rb @@ -31,6 +31,11 @@ module Users return user end + # Calling all before/after_destroy hooks for the user because + # there is no dependent: destroy in the relationship. And the removal + # is done by a foreign_key. Otherwise they won't be called + user.members.find_each { |member| member.run_callbacks(:destroy) } + user.solo_owned_groups.each do |group| Groups::DestroyService.new(group, current_user).execute end |