diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-03-02 09:25:25 +0100 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2018-03-02 11:44:18 +0100 |
commit | 1f4ee653fa7f8879192c38f65b277c5ffc786a0f (patch) | |
tree | dd95c9ec39e71282b9ad624172022c72489a97d0 /app/finders | |
parent | 911fd7c252dd6c43b9771b2833460f1605dc99a2 (diff) | |
download | gitlab-ce-1f4ee653fa7f8879192c38f65b277c5ffc786a0f.tar.gz |
Allow to include also descendant group labels
Because epic index page includes also epics from subgroups
it's necessary to also get descendant group labels for filtering.
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4773#note_61236542
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/labels_finder.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 5c9fce211ec..780c0fdb03e 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -61,12 +61,20 @@ class LabelsFinder < UnionFinder def group_ids strong_memoize(:group_ids) do - group = Group.find(params[:group_id]) - groups = params[:include_ancestor_groups].present? ? group.self_and_ancestors : [group] - groups_user_can_read_labels(groups).map(&:id) + groups_user_can_read_labels(groups_to_include).map(&:id) end end + def groups_to_include + group = Group.find(params[:group_id]) + groups = [group] + + groups += group.ancestors if params[:include_ancestor_groups].present? + groups += group.descendants if params[:include_descendant_groups].present? + + groups + end + def group? params[:group_id].present? end |