Commit 9d54da23 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Reuse `base_and_ancestors` for `ancestors` in `GroupHierarchy`

parent e55886b3
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment