diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-07 08:26:44 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-07 08:26:44 +0000 |
commit | 67c9f822dd60ef55323082cd0b17ccd6108a24c6 (patch) | |
tree | 716d434e45d4b43161e889d99c37b31415e22049 /app/models/namespace.rb | |
parent | 6a052a14e938ef073977afd808dd12a801f44369 (diff) | |
parent | cfa92112d189dce1028bce7145a5cbe609c389a8 (diff) | |
download | gitlab-ce-67c9f822dd60ef55323082cd0b17ccd6108a24c6.tar.gz |
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.rb | 7 |
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 |