summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-10 23:37:07 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:25 -0200
commit00e3c2e00f1c81aa2f7a76e4d93c8a1fb2074d6e (patch)
treea874d3fed374495c84499936551e182c689d1795 /lib
parent1fd84700874ed29a7852b0f090dbaffd86cb8d00 (diff)
downloadgitlab-ce-00e3c2e00f1c81aa2f7a76e4d93c8a1fb2074d6e.tar.gz
Fix replace label references with links for group labels
Diffstat (limited to 'lib')
-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