From 9d54da23610dcb2f4bfd63aa67a9e01c20f01d38 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Tue, 10 Oct 2017 16:07:41 +0200 Subject: [PATCH] Reuse `base_and_ancestors` for `ancestors` in `GroupHierarchy` --- lib/gitlab/group_hierarchy.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/gitlab/group_hierarchy.rb b/lib/gitlab/group_hierarchy.rb index d88c415e1e5..42ded7c286f 100644 --- a/lib/gitlab/group_hierarchy.rb +++ b/lib/gitlab/group_hierarchy.rb @@ -30,8 +30,7 @@ module Gitlab # reached. So all ancestors *lower* than the specified ancestor will be # included. def ancestors(upto: nil) - read_only(base_and_ancestors_cte(upto).apply_to(model.all)) - .where.not(id: ancestors_base.select(:id)) + base_and_ancestors(upto: upto).where.not(id: ancestors_base.select(:id)) end # Returns a relation that includes the ancestors_base set of groups