summaryrefslogtreecommitdiff
path: root/lib/banzai/filter
diff options
context:
space:
mode:
Diffstat (limited to 'lib/banzai/filter')
-rw-r--r--lib/banzai/filter/label_reference_filter.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb
index 2ce33aa1d15..21085ae6d49 100644
--- a/lib/banzai/filter/label_reference_filter.rb
+++ b/lib/banzai/filter/label_reference_filter.rb
@@ -39,7 +39,13 @@ module Banzai
end
def find_labels(project)
- LabelsFinder.new(user, project_id: project.id).execute
+ label_ids = []
+ label_ids << project.group.labels.select(:id) if project.group.present?
+ label_ids << project.labels.select(:id)
+
+ union = Gitlab::SQL::Union.new(label_ids)
+
+ Label.where("labels.id IN (#{union.to_sql})")
end
# Parameters to pass to `Label.find_by` based on the given arguments