summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-06-13 15:41:17 +0200
committerToon Claes <toon@gitlab.com>2017-06-13 15:41:17 +0200
commit4aa397bf42f0f64a9a8d6d444ced5130b3ce2b2a (patch)
tree99a71a94b3d38b0f12a8f1169d5ddf06bf14fd9d
parent9a81e9419c0b0c721080988983b2c6584fac417c (diff)
downloadgitlab-ce-tc-fix-group-finder-subgrouping.tar.gz
Better exception message and some additional code commenttc-fix-group-finder-subgrouping
-rw-r--r--lib/gitlab/group_hierarchy.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/group_hierarchy.rb b/lib/gitlab/group_hierarchy.rb
index 8a1d0ee57f7..357c076e874 100644
--- a/lib/gitlab/group_hierarchy.rb
+++ b/lib/gitlab/group_hierarchy.rb
@@ -10,7 +10,7 @@ module Gitlab
# descendants_base - An instance of ActiveRecord::Relation for which to
# get child groups. If omitted, ancestors_base is used.
def initialize(ancestors_base, descendants_base = ancestors_base)
- raise ArgumentError if ancestors_base.model != descendants_base.model
+ raise ArgumentError.new("Model of ancestors_base does not match model of descendants_base") if ancestors_base.model != descendants_base.model
@ancestors_base = ancestors_base
@descendants_base = descendants_base
@@ -53,6 +53,8 @@ module Gitlab
#
# Using this approach allows us to further add criteria to the relation with
# Rails thinking it's selecting data the usual way.
+ #
+ # If nested groups are not supported, ancestors_base is returned.
def all_groups
return ancestors_base unless Group.supports_nested_groups?