Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-03-02 11:25:25 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2018-03-02 13:44:18 +0300
commit1f4ee653fa7f8879192c38f65b277c5ffc786a0f (patch)
treedd95c9ec39e71282b9ad624172022c72489a97d0 /app/finders
parent911fd7c252dd6c43b9771b2833460f1605dc99a2 (diff)
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.rb14
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