diff options
author | Jarka Košanová <jarka@gitlab.com> | 2018-12-18 13:15:51 +0100 |
---|---|---|
committer | Jarka Košanová <jarka@gitlab.com> | 2018-12-19 15:24:29 +0100 |
commit | b1c39553859bb1f5f830fa759f2202462fe24d98 (patch) | |
tree | 235757cdbb225f709ecf105187b69a5f39c711bf /app/models/namespace.rb | |
parent | b1b7fa7802eecbacff04a9434eff69b0f3cbaaad (diff) | |
download | gitlab-ce-b1c39553859bb1f5f830fa759f2202462fe24d98.tar.gz |
Rename GroupHierarchy into ObjectHierarchy
- we now use the hierarchy class also for epics
- also rename supports_nested_groups? into supports_nested_objects?
- move it to a concern
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 3c9b1d32a53..36de1c41b67 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -175,16 +175,16 @@ class Namespace < ActiveRecord::Base # Returns all ancestors, self, and descendants of the current namespace. def self_and_hierarchy - Gitlab::GroupHierarchy + Gitlab::ObjectHierarchy .new(self.class.where(id: id)) - .all_groups + .all_objects end # Returns all the ancestors of the current namespaces. def ancestors return self.class.none unless parent_id - Gitlab::GroupHierarchy + Gitlab::ObjectHierarchy .new(self.class.where(id: parent_id)) .base_and_ancestors end @@ -192,27 +192,27 @@ class Namespace < ActiveRecord::Base # returns all ancestors upto but excluding the given namespace # when no namespace is given, all ancestors upto the top are returned def ancestors_upto(top = nil, hierarchy_order: nil) - Gitlab::GroupHierarchy.new(self.class.where(id: id)) + Gitlab::ObjectHierarchy.new(self.class.where(id: id)) .ancestors(upto: top, hierarchy_order: hierarchy_order) end def self_and_ancestors return self.class.where(id: id) unless parent_id - Gitlab::GroupHierarchy + Gitlab::ObjectHierarchy .new(self.class.where(id: id)) .base_and_ancestors end # Returns all the descendants of the current namespace. def descendants - Gitlab::GroupHierarchy + Gitlab::ObjectHierarchy .new(self.class.where(parent_id: id)) .base_and_descendants end def self_and_descendants - Gitlab::GroupHierarchy + Gitlab::ObjectHierarchy .new(self.class.where(id: id)) .base_and_descendants end @@ -293,7 +293,7 @@ class Namespace < ActiveRecord::Base end def force_share_with_group_lock_on_descendants - return unless Group.supports_nested_groups? + return unless Group.supports_nested_objects? # We can't use `descendants.update_all` since Rails will throw away the WITH # RECURSIVE statement. We also can't use WHERE EXISTS since we can't use |