Commit graph

11 commits

Author SHA1 Message Date
Bob Van Landuyt
9d1348d668 Move the ancestors_upto to Project and Namespace 2017-10-10 16:55:02 +02:00
Bob Van Landuyt
57bd3bb34a Force parents to be preloaded for building a hierarchy 2017-10-05 11:10:57 +02:00
Bob Van Landuyt
06e00913f5 Move merging of Hashes out of the GroupDescendant concern
Since it can technically merge any hash with objects that respond to `==`
2017-10-04 22:49:42 +02:00
Bob Van Landuyt
67815272dc Return an empty array when no matches are found 2017-10-04 22:49:42 +02:00
Bob Van Landuyt
167fd71348 Always preload all elements in a hierarchy to avoid extra queries. 2017-10-04 22:49:42 +02:00
Bob Van Landuyt
ef043063f9 Clean up public/private api of GroupDescendant
So only methods that are used elsewhere are public.
2017-10-04 22:49:42 +02:00
Bob Van Landuyt
af0b8e0558 Only preload ancestors for search results in the specified parent
When filtering we want all to preload all the ancestors upto the specified
parent group.

- root
  - subgroup
    - nested-group
      - project

So when searching 'project', on the 'subgroup' page we want to preload
'nested-group' but not 'subgroup' or 'root'
2017-10-04 22:49:42 +02:00
Bob Van Landuyt
ac0b104ae4 Minimize the number of queries by preloading counts and ancestors
By preloading the count of members, projects and subgroups of a group,
we don't need to query them later.

We also preload the entire hierarchy for a search result and include
the counts so we don't need to query for them again
2017-10-04 22:49:42 +02:00
Bob Van Landuyt
cd85c22faa Rename hierarchies to descendants where applicable 2017-10-04 22:49:42 +02:00
Bob Van Landuyt
cd8e1b85b6 Keep the parent method in Project 2017-10-04 22:49:41 +02:00
Bob Van Landuyt
22aa034427 Rename GroupHierarchy to GroupDescendant 2017-10-04 22:49:41 +02:00
Renamed from app/models/concerns/group_hierarchy.rb (Browse further)