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:
authorDouwe Maan <douwe@gitlab.com>2018-05-07 11:26:44 +0300
committerDouwe Maan <douwe@gitlab.com>2018-05-07 11:26:44 +0300
commit67c9f822dd60ef55323082cd0b17ccd6108a24c6 (patch)
tree716d434e45d4b43161e889d99c37b31415e22049 /app/models/namespace.rb
parent6a052a14e938ef073977afd808dd12a801f44369 (diff)
parentcfa92112d189dce1028bce7145a5cbe609c389a8 (diff)
Merge branch '4084-epics-username-autocomplete-ce' into 'master'
Backport CE changes from "autocomplete usernames in Epic comments/description" See merge request gitlab-org/gitlab-ce!18605
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 5621eeba7c4..3dad4277713 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -166,6 +166,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