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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-09-29 21:50:14 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 19:58:25 +0300
commit3db2261005c438faad8bf4a339d46eb7798f05b5 (patch)
treeb09acae73956cf67ed160a3ae2c4139a9140921a /lib/banzai
parent723e576782aefa339a4db8916908c7ebe5a92f48 (diff)
Reuse LabelsFinder on Banzai::Filter::LabelReferenceFilter
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/label_reference_filter.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb
index 649c697b415..2ce33aa1d15 100644
--- a/lib/banzai/filter/label_reference_filter.rb
+++ b/lib/banzai/filter/label_reference_filter.rb
@@ -39,13 +39,7 @@ module Banzai
end
def find_labels(project)
- 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)
-
- object_class.where("labels.id IN (#{union.to_sql})")
+ LabelsFinder.new(user, project_id: project.id).execute
end
# Parameters to pass to `Label.find_by` based on the given arguments
@@ -91,6 +85,10 @@ module Banzai
object.is_a?(ProjectLabel) && object.project == project
end
+ def user
+ context[:current_user] || context[:author]
+ end
+
def project
context[:project]
end