Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2018-04-26 22:53:13 +0300
committerMario de la Ossa <mariodelaossa@gmail.com>2018-05-04 20:33:09 +0300
commit5c2078838bb9de710f9025513c4b6ec664bba313 (patch)
tree338656dae97b6c6687e6794b583b0ae431aa5e2f /app/models/namespace.rb
parente71351d4f463715fccd80ddbcb4dade67e80f34b (diff)
Backport of 4084-epics-username-autocomplete
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index c29a53e5ce7..637bcbc7a09 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -163,6 +163,13 @@ class Namespace < ActiveRecord::Base
projects.with_shared_runners.any?
end
+ # Returns all ancestors, self, and descendants of the current namespace.
+ def self_and_hierarchy
+ Gitlab::GroupHierarchy
+ .new(self.class.where(id: id))
+ .all_groups
+ end
+
# Returns all the ancestors of the current namespaces.
def ancestors
return self.class.none unless parent_id