summaryrefslogtreecommitdiff
path: root/app/models/group.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 07fb62bb249..bb1d5aacdd7 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -42,6 +42,7 @@ class Group < Namespace
after_create :post_create_hook
after_destroy :post_destroy_hook
after_save :update_two_factor_requirement
+ after_save :path_changed_hook, if: :has_path_changed?
class << self
def supports_nested_groups?
@@ -297,6 +298,20 @@ class Group < Namespace
users.find_each(&:update_two_factor_requirement)
end
+ def has_path_changed?
+ path_changed? && !path_was.nil?
+ end
+
+ def full_path_was
+ return model.path_was unless has_parent?
+
+ "#{parent.full_path}/#{path_was}"
+ end
+
+ def path_changed_hook
+ system_hook_service.execute_hooks_for(self, :rename)
+ end
+
def visibility_level_allowed_by_parent
return if visibility_level_allowed_by_parent?