diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-11-26 22:01:18 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-12-05 10:16:44 +1300 |
commit | 8419b7dd2b85fbe9216a31ce84d5ecb234a8b90a (patch) | |
tree | 2d0ae5162d844dc9cf37005007e7e9a998e433a9 /app/models/clusters/cluster.rb | |
parent | 9c5977c821c1958709227a7a5976e1faedc53923 (diff) | |
download | gitlab-ce-8419b7dd2b85fbe9216a31ce84d5ecb234a8b90a.tar.gz |
Teach Cluster about #all_projects
For project level, it's the project directly associated. For group
level, it's the projects under that group.
Diffstat (limited to 'app/models/clusters/cluster.rb')
-rw-r--r-- | app/models/clusters/cluster.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index e85e7a4e8be..54314f69c3d 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -133,6 +133,16 @@ module Clusters !user? end + def all_projects + if project_type? + projects + elsif group_type? + first_group.all_projects + else + Project.none + end + end + def first_project strong_memoize(:first_project) do projects.first |